<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
	<title>API: menu   menuitem.js  (YUI Library)</title>
	<link rel="stylesheet" type="text/css" href="assets/reset-fonts-grids-min.css">
	<link rel="stylesheet" type="text/css" href="assets/api.css">
</head>

<body id="yahoo-com">
<div id="doc3" class="yui-t2">

	<div id="hd">
        <h1>Yahoo! UI Library</h1>
        <h3>Menu Library&nbsp;</h3>
        <p>
        <a href="./index.html">Yahoo! UI Library</a> 
            &gt; <a href="./module_menu.html">menu</a>
                
                 &gt; menuitem.js (source view) 
            </p>
	</div>

	<div id="bd">
		<div id="yui-main">
			<div class="yui-b">

                    <div id="srcout">
<div class="highlight" ><pre><span class="o">(</span><span class="k">function</span><span class="o">()</span> <span class="o">{</span>

<span class="k">var</span> <span class="nx">Dom</span> <span class="o">=</span> <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">util</span><span class="o">.</span><span class="nx">Dom</span><span class="o">,</span>
    <span class="nx">Module</span> <span class="o">=</span> <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">Module</span><span class="o">,</span>
    <span class="nx">Menu</span> <span class="o">=</span> <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">Menu</span><span class="o">;</span>


<span class="c">/**</span>
<span class="c">* Creates an item for a menu.</span>
<span class="c">* </span>
<span class="c">* @param {String} p_oObject String specifying the text of the menu item.</span>
<span class="c">* @param {&lt;a href=&quot;http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/level-</span>
<span class="c">* one-html.html#ID-74680021&quot;&gt;HTMLLIElement&lt;/a&gt;} p_oObject Object specifying </span>
<span class="c">* the &lt;code&gt;&amp;#60;li&amp;#62;&lt;/code&gt; element of the menu item.</span>
<span class="c">* @param {&lt;a href=&quot;http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/level-</span>
<span class="c">* one-html.html#ID-38450247&quot;&gt;HTMLOptGroupElement&lt;/a&gt;} p_oObject Object </span>
<span class="c">* specifying the &lt;code&gt;&amp;#60;optgroup&amp;#62;&lt;/code&gt; element of the menu item.</span>
<span class="c">* @param {&lt;a href=&quot;http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/level-</span>
<span class="c">* one-html.html#ID-70901257&quot;&gt;HTMLOptionElement&lt;/a&gt;} p_oObject Object </span>
<span class="c">* specifying the &lt;code&gt;&amp;#60;option&amp;#62;&lt;/code&gt; element of the menu item.</span>
<span class="c">* @param {Object} p_oConfig Optional. Object literal specifying the </span>
<span class="c">* configuration for the menu item. See configuration class documentation </span>
<span class="c">* for more details.</span>
<span class="c">* @class MenuItem</span>
<span class="c">* @constructor</span>
<span class="c">*/</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">MenuItem</span> <span class="o">=</span> <span class="k">function</span><span class="o">(</span><span class="nx">p_oObject</span><span class="o">,</span> <span class="nx">p_oConfig</span><span class="o">)</span> <span class="o">{</span>

    <span class="k">if</span><span class="o">(</span><span class="nx">p_oObject</span><span class="o">)</span> <span class="o">{</span>

        <span class="k">if</span><span class="o">(</span><span class="nx">p_oConfig</span><span class="o">)</span> <span class="o">{</span>
    
            <span class="k">this</span><span class="o">.</span><span class="nx">parent</span> <span class="o">=</span> <span class="nx">p_oConfig</span><span class="o">.</span><span class="nx">parent</span><span class="o">;</span>
            <span class="k">this</span><span class="o">.</span><span class="nx">value</span> <span class="o">=</span> <span class="nx">p_oConfig</span><span class="o">.</span><span class="nx">value</span><span class="o">;</span>
            
        <span class="o">}</span>

        <span class="k">this</span><span class="o">.</span><span class="nx">init</span><span class="o">(</span><span class="nx">p_oObject</span><span class="o">,</span> <span class="nx">p_oConfig</span><span class="o">);</span>

    <span class="o">}</span>

<span class="o">};</span>

<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">MenuItem</span><span class="o">.</span><span class="nx">prototype</span> <span class="o">=</span> <span class="o">{</span>

    <span class="c">// Constants</span>
<span class="c"></span>
    <span class="c">/**</span>
<span class="c">    * @property SUBMENU_INDICATOR_IMAGE_PATH</span>
<span class="c">    * @description String representing the path to the image to be used for the </span>
<span class="c">    * menu item&#39;s submenu arrow indicator.</span>
<span class="c">    * @default &quot;nt/ic/ut/alt1/menuarorght8_nrm_1.gif&quot;</span>
<span class="c">    * @final</span>
<span class="c">    * @type String</span>
<span class="c">    */</span>
    <span class="nx">SUBMENU_INDICATOR_IMAGE_PATH</span><span class="o">:</span> <span class="s2">&quot;nt/ic/ut/alt1/menuarorght8_nrm_1.gif&quot;</span><span class="o">,</span>


    <span class="c">/**</span>
<span class="c">    * @property SELECTED_SUBMENU_INDICATOR_IMAGE_PATH</span>
<span class="c">    * @description String representing the path to the image to be used for the </span>
<span class="c">    * submenu arrow indicator when the menu item is selected.</span>
<span class="c">    * @default &quot;nt/ic/ut/alt1/menuarorght8_hov_1.gif&quot;</span>
<span class="c">    * @final</span>
<span class="c">    * @type String</span>
<span class="c">    */</span>
    <span class="nx">SELECTED_SUBMENU_INDICATOR_IMAGE_PATH</span><span class="o">:</span> 
        <span class="s2">&quot;nt/ic/ut/alt1/menuarorght8_hov_1.gif&quot;</span><span class="o">,</span>


    <span class="c">/**</span>
<span class="c">    * @property DISABLED_SUBMENU_INDICATOR_IMAGE_PATH</span>
<span class="c">    * @description String representing the path to the image to be used for the </span>
<span class="c">    * submenu arrow indicator when the menu item is disabled.</span>
<span class="c">    * @default &quot;nt/ic/ut/alt1/menuarorght8_dim_1.gif&quot;</span>
<span class="c">    * @final</span>
<span class="c">    * @type String</span>
<span class="c">    */</span>
    <span class="nx">DISABLED_SUBMENU_INDICATOR_IMAGE_PATH</span><span class="o">:</span> 
        <span class="s2">&quot;nt/ic/ut/alt1/menuarorght8_dim_1.gif&quot;</span><span class="o">,</span>


    <span class="c">/**</span>
<span class="c">    * @property COLLAPSED_SUBMENU_INDICATOR_ALT_TEXT</span>
<span class="c">    * @description String representing the alt text for the image to be used </span>
<span class="c">    * for the submenu arrow indicator.</span>
<span class="c">    * @default &quot;Collapsed.  Click to expand.&quot;</span>
<span class="c">    * @final</span>
<span class="c">    * @type String</span>
<span class="c">    */</span>
    <span class="nx">COLLAPSED_SUBMENU_INDICATOR_ALT_TEXT</span><span class="o">:</span> <span class="s2">&quot;Collapsed.  Click to expand.&quot;</span><span class="o">,</span>


    <span class="c">/**</span>
<span class="c">    * @property EXPANDED_SUBMENU_INDICATOR_ALT_TEXT</span>
<span class="c">    * @description String representing the alt text for the image to be used </span>
<span class="c">    * for the submenu arrow indicator when the submenu is visible.</span>
<span class="c">    * @default &quot;Expanded.  Click to collapse.&quot;</span>
<span class="c">    * @final</span>
<span class="c">    * @type String</span>
<span class="c">    */</span>
    <span class="nx">EXPANDED_SUBMENU_INDICATOR_ALT_TEXT</span><span class="o">:</span> <span class="s2">&quot;Expanded.  Click to collapse.&quot;</span><span class="o">,</span>


    <span class="c">/**</span>
<span class="c">    * @property DISABLED_SUBMENU_INDICATOR_ALT_TEXT</span>
<span class="c">    * @description String representing the alt text for the image to be used </span>
<span class="c">    * for the submenu arrow indicator when the menu item is disabled.</span>
<span class="c">    * @default &quot;Disabled.&quot;</span>
<span class="c">    * @final</span>
<span class="c">    * @type String</span>
<span class="c">    */</span>
    <span class="nx">DISABLED_SUBMENU_INDICATOR_ALT_TEXT</span><span class="o">:</span> <span class="s2">&quot;Disabled.&quot;</span><span class="o">,</span>


    <span class="c">/**</span>
<span class="c">    * @property CHECKED_IMAGE_PATH</span>
<span class="c">    * @description String representing the path to the image to be used for </span>
<span class="c">    * the checked state.</span>
<span class="c">    * @default &quot;nt/ic/ut/bsc/menuchk8_nrm_1.gif&quot;</span>
<span class="c">    * @final</span>
<span class="c">    * @type String</span>
<span class="c">    */</span>
    <span class="nx">CHECKED_IMAGE_PATH</span><span class="o">:</span> <span class="s2">&quot;nt/ic/ut/bsc/menuchk8_nrm_1.gif&quot;</span><span class="o">,</span>
    

    <span class="c">/**</span>
<span class="c">    * @property SELECTED_CHECKED_IMAGE_PATH</span>
<span class="c">    * @description String representing the path to the image to be used for </span>
<span class="c">    * the selected checked state.</span>
<span class="c">    * @default &quot;nt/ic/ut/bsc/menuchk8_hov_1.gif&quot;</span>
<span class="c">    * @final</span>
<span class="c">    * @type String</span>
<span class="c">    */</span>
    <span class="nx">SELECTED_CHECKED_IMAGE_PATH</span><span class="o">:</span> <span class="s2">&quot;nt/ic/ut/bsc/menuchk8_hov_1.gif&quot;</span><span class="o">,</span>
    

    <span class="c">/**</span>
<span class="c">    * @property DISABLED_CHECKED_IMAGE_PATH</span>
<span class="c">    * @description String representing the path to the image to be used for </span>
<span class="c">    * the disabled checked state.</span>
<span class="c">    * @default &quot;nt/ic/ut/bsc/menuchk8_dim_1.gif&quot;</span>
<span class="c">    * @final</span>
<span class="c">    * @type String</span>
<span class="c">    */</span>
    <span class="nx">DISABLED_CHECKED_IMAGE_PATH</span><span class="o">:</span> <span class="s2">&quot;nt/ic/ut/bsc/menuchk8_dim_1.gif&quot;</span><span class="o">,</span>
    

    <span class="c">/**</span>
<span class="c">    * @property CHECKED_IMAGE_ALT_TEXT</span>
<span class="c">    * @description String representing the alt text for the image to be used </span>
<span class="c">    * for the checked image.</span>
<span class="c">    * @default &quot;Checked.&quot;</span>
<span class="c">    * @final</span>
<span class="c">    * @type String</span>
<span class="c">    */</span>
    <span class="nx">CHECKED_IMAGE_ALT_TEXT</span><span class="o">:</span> <span class="s2">&quot;Checked.&quot;</span><span class="o">,</span>
    
    
    <span class="c">/**</span>
<span class="c">    * @property DISABLED_CHECKED_IMAGE_ALT_TEXT</span>
<span class="c">    * @description String representing the alt text for the image to be used </span>
<span class="c">    * for the checked image when the item is disabled.</span>
<span class="c">    * @default &quot;Checked. (Item disabled.)&quot;</span>
<span class="c">    * @final</span>
<span class="c">    * @type String</span>
<span class="c">    */</span>
    <span class="nx">DISABLED_CHECKED_IMAGE_ALT_TEXT</span><span class="o">:</span> <span class="s2">&quot;Checked. (Item disabled.)&quot;</span><span class="o">,</span>


    <span class="c">/**</span>
<span class="c">    * @property CSS_CLASS_NAME</span>
<span class="c">    * @description String representing the CSS class(es) to be applied to the </span>
<span class="c">    * &lt;code&gt;&amp;#60;li&amp;#62;&lt;/code&gt; element of the menu item.</span>
<span class="c">    * @default &quot;yuimenuitem&quot;</span>
<span class="c">    * @final</span>
<span class="c">    * @type String</span>
<span class="c">    */</span>
    <span class="nx">CSS_CLASS_NAME</span><span class="o">:</span> <span class="s2">&quot;yuimenuitem&quot;</span><span class="o">,</span>


    <span class="c">/**</span>
<span class="c">    * @property SUBMENU_TYPE</span>
<span class="c">    * @description Object representing the type of menu to instantiate and </span>
<span class="c">    * add when parsing the child nodes of the menu item&#39;s source HTML element.</span>
<span class="c">    * @final</span>
<span class="c">    * @type YAHOO.widget.Menu</span>
<span class="c">    */</span>
    <span class="nx">SUBMENU_TYPE</span><span class="o">:</span> <span class="kc">null</span><span class="o">,</span>


    <span class="c">/**</span>
<span class="c">    * @property IMG_ROOT</span>
<span class="c">    * @description String representing the prefix path to use for </span>
<span class="c">    * non-secure images.</span>
<span class="c">    * @default &quot;http://us.i1.yimg.com/us.yimg.com/i/&quot;</span>
<span class="c">    * @type String</span>
<span class="c">    */</span>
    <span class="nx">IMG_ROOT</span><span class="o">:</span> <span class="s2">&quot;http://us.i1.yimg.com/us.yimg.com/i/&quot;</span><span class="o">,</span>
    

    <span class="c">/**</span>
<span class="c">    * @property IMG_ROOT_SSL</span>
<span class="c">    * @description String representing the prefix path to use for securely </span>
<span class="c">    * served images.</span>
<span class="c">    * @default &quot;https://a248.e.akamai.net/sec.yimg.com/i/&quot;</span>
<span class="c">    * @type String</span>
<span class="c">    */</span>
    <span class="nx">IMG_ROOT_SSL</span><span class="o">:</span> <span class="s2">&quot;https://a248.e.akamai.net/sec.yimg.com/i/&quot;</span><span class="o">,</span>



    <span class="c">// Private member variables</span>
<span class="c"></span>    
    <span class="c">/**</span>
<span class="c">    * @property _oAnchor</span>
<span class="c">    * @description Object reference to the menu item&#39;s </span>
<span class="c">    * &lt;code&gt;&amp;#60;a&amp;#62;&lt;/code&gt; element.</span>
<span class="c">    * @default null </span>
<span class="c">    * @private</span>
<span class="c">    * @type &lt;a href=&quot;http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/level-</span>
<span class="c">    * one-html.html#ID-48250443&quot;&gt;HTMLAnchorElement&lt;/a&gt;</span>
<span class="c">    */</span>
    <span class="nx">_oAnchor</span><span class="o">:</span> <span class="kc">null</span><span class="o">,</span>
    

    <span class="c">/**</span>
<span class="c">    * @property _oText</span>
<span class="c">    * @description Object reference to the menu item&#39;s text node.</span>
<span class="c">    * @default null</span>
<span class="c">    * @private</span>
<span class="c">    * @type TextNode</span>
<span class="c">    */</span>
    <span class="nx">_oText</span><span class="o">:</span> <span class="kc">null</span><span class="o">,</span>
    
    
    <span class="c">/**</span>
<span class="c">    * @property _oHelpTextEM</span>
<span class="c">    * @description Object reference to the menu item&#39;s help text </span>
<span class="c">    * &lt;code&gt;&amp;#60;em&amp;#62;&lt;/code&gt; element.</span>
<span class="c">    * @default null</span>
<span class="c">    * @private</span>
<span class="c">    * @type &lt;a href=&quot;http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/level-</span>
<span class="c">    * one-html.html#ID-58190037&quot;&gt;HTMLElement&lt;/a&gt;</span>
<span class="c">    */</span>
    <span class="nx">_oHelpTextEM</span><span class="o">:</span> <span class="kc">null</span><span class="o">,</span>
    
    
    <span class="c">/**</span>
<span class="c">    * @property _oSubmenu</span>
<span class="c">    * @description Object reference to the menu item&#39;s submenu.</span>
<span class="c">    * @default null</span>
<span class="c">    * @private</span>
<span class="c">    * @type YAHOO.widget.Menu</span>
<span class="c">    */</span>
    <span class="nx">_oSubmenu</span><span class="o">:</span> <span class="kc">null</span><span class="o">,</span>


    <span class="c">/**</span>
<span class="c">    * @property _checkImage</span>
<span class="c">    * @description Object reference to the menu item&#39;s checkmark image.</span>
<span class="c">    * @default null</span>
<span class="c">    * @private</span>
<span class="c">    * @type &lt;a href=&quot;http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/level-</span>
<span class="c">    * one-html.html#ID-17701901&quot;&gt;HTMLImageElement&lt;/a&gt;</span>
<span class="c">    */</span>
    <span class="nx">_checkImage</span><span class="o">:</span> <span class="kc">null</span><span class="o">,</span>



    <span class="c">// Public properties</span>
<span class="c"></span>
	<span class="c">/**</span>
<span class="c">    * @property constructor</span>
<span class="c">	* @description Object reference to the menu item&#39;s constructor function.</span>
<span class="c">    * @default YAHOO.widget.MenuItem</span>
<span class="c">	* @type YAHOO.widget.MenuItem</span>
<span class="c">	*/</span>
	<span class="nx">constructor</span><span class="o">:</span> <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">MenuItem</span><span class="o">,</span>


	<span class="c">/**</span>
<span class="c">    * @property imageRoot</span>
<span class="c">	* @description String representing the root path for all of the menu </span>
<span class="c">	* item&#39;s images.</span>
<span class="c">	* @type String</span>
<span class="c">	*/</span>
	<span class="nx">imageRoot</span><span class="o">:</span> <span class="kc">null</span><span class="o">,</span>


	<span class="c">/**</span>
<span class="c">    * @property isSecure</span>
<span class="c">	* @description Boolean representing whether or not the current browsing </span>
<span class="c">	* context is secure (HTTPS).</span>
<span class="c">	* @type Boolean</span>
<span class="c">	*/</span>
	<span class="nx">isSecure</span><span class="o">:</span> <span class="nx">Module</span><span class="o">.</span><span class="nx">prototype</span><span class="o">.</span><span class="nx">isSecure</span><span class="o">,</span>


    <span class="c">/**</span>
<span class="c">    * @property index</span>
<span class="c">    * @description Number indicating the ordinal position of the menu item in </span>
<span class="c">    * its group.</span>
<span class="c">    * @default null</span>
<span class="c">    * @type Number</span>
<span class="c">    */</span>
    <span class="nx">index</span><span class="o">:</span> <span class="kc">null</span><span class="o">,</span>


    <span class="c">/**</span>
<span class="c">    * @property groupIndex</span>
<span class="c">    * @description Number indicating the index of the group to which the menu </span>
<span class="c">    * item belongs.</span>
<span class="c">    * @default null</span>
<span class="c">    * @type Number</span>
<span class="c">    */</span>
    <span class="nx">groupIndex</span><span class="o">:</span> <span class="kc">null</span><span class="o">,</span>


    <span class="c">/**</span>
<span class="c">    * @property parent</span>
<span class="c">    * @description Object reference to the menu item&#39;s parent menu.</span>
<span class="c">    * @default null</span>
<span class="c">    * @type YAHOO.widget.Menu</span>
<span class="c">    */</span>
    <span class="nx">parent</span><span class="o">:</span> <span class="kc">null</span><span class="o">,</span>


    <span class="c">/**</span>
<span class="c">    * @property element</span>
<span class="c">    * @description Object reference to the menu item&#39;s </span>
<span class="c">    * &lt;code&gt;&amp;#60;li&amp;#62;&lt;/code&gt; element.</span>
<span class="c">    * @default &lt;a href=&quot;http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/level</span>
<span class="c">    * -one-html.html#ID-74680021&quot;&gt;HTMLLIElement&lt;/a&gt;</span>
<span class="c">    * @type &lt;a href=&quot;http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/level-</span>
<span class="c">    * one-html.html#ID-74680021&quot;&gt;HTMLLIElement&lt;/a&gt;</span>
<span class="c">    */</span>
    <span class="nx">element</span><span class="o">:</span> <span class="kc">null</span><span class="o">,</span>


    <span class="c">/**</span>
<span class="c">    * @property srcElement</span>
<span class="c">    * @description Object reference to the HTML element (either </span>
<span class="c">    * &lt;code&gt;&amp;#60;li&amp;#62;&lt;/code&gt;, &lt;code&gt;&amp;#60;optgroup&amp;#62;&lt;/code&gt; or </span>
<span class="c">    * &lt;code&gt;&amp;#60;option&amp;#62;&lt;/code&gt;) used create the menu item.</span>
<span class="c">    * @default &lt;a href=&quot;http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/</span>
<span class="c">    * level-one-html.html#ID-74680021&quot;&gt;HTMLLIElement&lt;/a&gt;|&lt;a href=&quot;http://www.</span>
<span class="c">    * w3.org/TR/2000/WD-DOM-Level-1-20000929/level-one-html.html#ID-38450247&quot;</span>
<span class="c">    * &gt;HTMLOptGroupElement&lt;/a&gt;|&lt;a href=&quot;http://www.w3.org/TR/2000/WD-DOM-</span>
<span class="c">    * Level-1-20000929/level-one-html.html#ID-70901257&quot;&gt;HTMLOptionElement&lt;/a&gt;</span>
<span class="c">    * @type &lt;a href=&quot;http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/level-</span>
<span class="c">    * one-html.html#ID-74680021&quot;&gt;HTMLLIElement&lt;/a&gt;|&lt;a href=&quot;http://www.w3.</span>
<span class="c">    * org/TR/2000/WD-DOM-Level-1-20000929/level-one-html.html#ID-38450247&quot;&gt;</span>
<span class="c">    * HTMLOptGroupElement&lt;/a&gt;|&lt;a href=&quot;http://www.w3.org/TR/2000/WD-DOM-</span>
<span class="c">    * Level-1-20000929/level-one-html.html#ID-70901257&quot;&gt;HTMLOptionElement&lt;/a&gt;</span>
<span class="c">    */</span>
    <span class="nx">srcElement</span><span class="o">:</span> <span class="kc">null</span><span class="o">,</span>


    <span class="c">/**</span>
<span class="c">    * @property value</span>
<span class="c">    * @description Object reference to the menu item&#39;s value.</span>
<span class="c">    * @default null</span>
<span class="c">    * @type Object</span>
<span class="c">    */</span>
    <span class="nx">value</span><span class="o">:</span> <span class="kc">null</span><span class="o">,</span>


    <span class="c">/**</span>
<span class="c">    * @property submenuIndicator</span>
<span class="c">    * @description Object reference to the &lt;code&gt;&amp;#60;img&amp;#62;&lt;/code&gt; element </span>
<span class="c">    * used to create the submenu indicator for the menu item.</span>
<span class="c">    * @default &lt;a href=&quot;http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/</span>
<span class="c">    * level-one-html.html#ID-17701901&quot;&gt;HTMLImageElement&lt;/a&gt;</span>
<span class="c">    * @type &lt;a href=&quot;http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/</span>
<span class="c">    * level-one-html.html#ID-17701901&quot;&gt;HTMLImageElement&lt;/a&gt;</span>
<span class="c">    */</span>
    <span class="nx">submenuIndicator</span><span class="o">:</span> <span class="kc">null</span><span class="o">,</span>


	<span class="c">/**</span>
<span class="c">    * @property browser</span>
<span class="c">	* @description String representing the browser.</span>
<span class="c">	* @type String</span>
<span class="c">	*/</span>
	<span class="nx">browser</span><span class="o">:</span> <span class="nx">Module</span><span class="o">.</span><span class="nx">prototype</span><span class="o">.</span><span class="nx">browser</span><span class="o">,</span>



    <span class="c">// Events</span>
<span class="c"></span>

    <span class="c">/**</span>
<span class="c">    * @event destroyEvent</span>
<span class="c">    * @description Fires when the menu item&#39;s &lt;code&gt;&amp;#60;li&amp;#62;&lt;/code&gt; </span>
<span class="c">    * element is removed from its parent &lt;code&gt;&amp;#60;ul&amp;#62;&lt;/code&gt; element.</span>
<span class="c">    * @type YAHOO.util.CustomEvent</span>
<span class="c">    */</span>
    <span class="nx">destroyEvent</span><span class="o">:</span> <span class="kc">null</span><span class="o">,</span>


    <span class="c">/**</span>
<span class="c">    * @event mouseOverEvent</span>
<span class="c">    * @description Fires when the mouse has entered the menu item.  Passes </span>
<span class="c">    * back the DOM Event object as an argument.</span>
<span class="c">    * @type YAHOO.util.CustomEvent</span>
<span class="c">    */</span>
    <span class="nx">mouseOverEvent</span><span class="o">:</span> <span class="kc">null</span><span class="o">,</span>


    <span class="c">/**</span>
<span class="c">    * @event mouseOutEvent</span>
<span class="c">    * @description Fires when the mouse has left the menu item.  Passes back </span>
<span class="c">    * the DOM Event object as an argument.</span>
<span class="c">    * @type YAHOO.util.CustomEvent</span>
<span class="c">    */</span>
    <span class="nx">mouseOutEvent</span><span class="o">:</span> <span class="kc">null</span><span class="o">,</span>


    <span class="c">/**</span>
<span class="c">    * @event mouseDownEvent</span>
<span class="c">    * @description Fires when the user mouses down on the menu item.  Passes </span>
<span class="c">    * back the DOM Event object as an argument.</span>
<span class="c">    * @type YAHOO.util.CustomEvent</span>
<span class="c">    */</span>
    <span class="nx">mouseDownEvent</span><span class="o">:</span> <span class="kc">null</span><span class="o">,</span>


    <span class="c">/**</span>
<span class="c">    * @event mouseUpEvent</span>
<span class="c">    * @description Fires when the user releases a mouse button while the mouse </span>
<span class="c">    * is over the menu item.  Passes back the DOM Event object as an argument.</span>
<span class="c">    * @type YAHOO.util.CustomEvent</span>
<span class="c">    */</span>
    <span class="nx">mouseUpEvent</span><span class="o">:</span> <span class="kc">null</span><span class="o">,</span>


    <span class="c">/**</span>
<span class="c">    * @event clickEvent</span>
<span class="c">    * @description Fires when the user clicks the on the menu item.  Passes </span>
<span class="c">    * back the DOM Event object as an argument.</span>
<span class="c">    * @type YAHOO.util.CustomEvent</span>
<span class="c">    */</span>
    <span class="nx">clickEvent</span><span class="o">:</span> <span class="kc">null</span><span class="o">,</span>


    <span class="c">/**</span>
<span class="c">    * @event keyPressEvent</span>
<span class="c">    * @description Fires when the user presses an alphanumeric key when the </span>
<span class="c">    * menu item has focus.  Passes back the DOM Event object as an argument.</span>
<span class="c">    * @type YAHOO.util.CustomEvent</span>
<span class="c">    */</span>
    <span class="nx">keyPressEvent</span><span class="o">:</span> <span class="kc">null</span><span class="o">,</span>


    <span class="c">/**</span>
<span class="c">    * @event keyDownEvent</span>
<span class="c">    * @description Fires when the user presses a key when the menu item has </span>
<span class="c">    * focus.  Passes back the DOM Event object as an argument.</span>
<span class="c">    * @type YAHOO.util.CustomEvent</span>
<span class="c">    */</span>
    <span class="nx">keyDownEvent</span><span class="o">:</span> <span class="kc">null</span><span class="o">,</span>


    <span class="c">/**</span>
<span class="c">    * @event keyUpEvent</span>
<span class="c">    * @description Fires when the user releases a key when the menu item has </span>
<span class="c">    * focus.  Passes back the DOM Event object as an argument.</span>
<span class="c">    * @type YAHOO.util.CustomEvent</span>
<span class="c">    */</span>
    <span class="nx">keyUpEvent</span><span class="o">:</span> <span class="kc">null</span><span class="o">,</span>


    <span class="c">/**</span>
<span class="c">    * @event focusEvent</span>
<span class="c">    * @description Fires when the menu item receives focus.</span>
<span class="c">    * @type YAHOO.util.CustomEvent</span>
<span class="c">    */</span>
    <span class="nx">focusEvent</span><span class="o">:</span> <span class="kc">null</span><span class="o">,</span>


    <span class="c">/**</span>
<span class="c">    * @event blurEvent</span>
<span class="c">    * @description Fires when the menu item loses the input focus.</span>
<span class="c">    * @type YAHOO.util.CustomEvent</span>
<span class="c">    */</span>
    <span class="nx">blurEvent</span><span class="o">:</span> <span class="kc">null</span><span class="o">,</span>


    <span class="c">/**</span>
<span class="c">    * @method init</span>
<span class="c">    * @description The MenuItem class&#39;s initialization method. This method is </span>
<span class="c">    * automatically called by the constructor, and sets up all DOM references </span>
<span class="c">    * for pre-existing markup, and creates required markup if it is not </span>
<span class="c">    * already present.</span>
<span class="c">    * @param {String} p_oObject String specifying the text of the menu item.</span>
<span class="c">    * @param {&lt;a href=&quot;http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/level-</span>
<span class="c">    * one-html.html#ID-74680021&quot;&gt;HTMLLIElement&lt;/a&gt;} p_oObject Object specifying </span>
<span class="c">    * the &lt;code&gt;&amp;#60;li&amp;#62;&lt;/code&gt; element of the menu item.</span>
<span class="c">    * @param {&lt;a href=&quot;http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/level-</span>
<span class="c">    * one-html.html#ID-38450247&quot;&gt;HTMLOptGroupElement&lt;/a&gt;} p_oObject Object </span>
<span class="c">    * specifying the &lt;code&gt;&amp;#60;optgroup&amp;#62;&lt;/code&gt; element of the menu item.</span>
<span class="c">    * @param {&lt;a href=&quot;http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/level-</span>
<span class="c">    * one-html.html#ID-70901257&quot;&gt;HTMLOptionElement&lt;/a&gt;} p_oObject Object </span>
<span class="c">    * specifying the &lt;code&gt;&amp;#60;option&amp;#62;&lt;/code&gt; element of the menu item.</span>
<span class="c">    * @param {Object} p_oConfig Optional. Object literal specifying the </span>
<span class="c">    * configuration for the menu item. See configuration class documentation </span>
<span class="c">    * for more details.</span>
<span class="c">    */</span>
    <span class="nx">init</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">p_oObject</span><span class="o">,</span> <span class="nx">p_oConfig</span><span class="o">)</span> <span class="o">{</span>

        <span class="k">this</span><span class="o">.</span><span class="nx">imageRoot</span> <span class="o">=</span> <span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">isSecure</span><span class="o">)</span> <span class="o">?</span> <span class="k">this</span><span class="o">.</span><span class="nx">IMG_ROOT_SSL</span> <span class="o">:</span> <span class="k">this</span><span class="o">.</span><span class="nx">IMG_ROOT</span><span class="o">;</span>


        <span class="k">if</span><span class="o">(!</span><span class="k">this</span><span class="o">.</span><span class="nx">SUBMENU_TYPE</span><span class="o">)</span> <span class="o">{</span>
    
            <span class="k">this</span><span class="o">.</span><span class="nx">SUBMENU_TYPE</span> <span class="o">=</span> <span class="nx">Menu</span><span class="o">;</span>
    
        <span class="o">}</span>


        <span class="c">// Create the config object</span>
<span class="c"></span>
        <span class="k">this</span><span class="o">.</span><span class="nx">cfg</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">util</span><span class="o">.</span><span class="nx">Config</span><span class="o">(</span><span class="k">this</span><span class="o">);</span>

        <span class="k">this</span><span class="o">.</span><span class="nx">initDefaultConfig</span><span class="o">();</span>

        <span class="k">var</span> <span class="nx">oConfig</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">cfg</span><span class="o">;</span>


        <span class="k">if</span><span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">_checkString</span><span class="o">(</span><span class="nx">p_oObject</span><span class="o">))</span> <span class="o">{</span>

            <span class="k">this</span><span class="o">.</span><span class="nx">_createRootNodeStructure</span><span class="o">();</span>

            <span class="nx">oConfig</span><span class="o">.</span><span class="nx">setProperty</span><span class="o">(</span><span class="s2">&quot;text&quot;</span><span class="o">,</span> <span class="nx">p_oObject</span><span class="o">);</span>

        <span class="o">}</span>
        <span class="k">else</span> <span class="k">if</span><span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">_checkDOMNode</span><span class="o">(</span><span class="nx">p_oObject</span><span class="o">))</span> <span class="o">{</span>

            <span class="nx">switch</span><span class="o">(</span><span class="nx">p_oObject</span><span class="o">.</span><span class="nx">tagName</span><span class="o">.</span><span class="nx">toUpperCase</span><span class="o">())</span> <span class="o">{</span>

                <span class="nx">case</span> <span class="s2">&quot;OPTION&quot;</span><span class="o">:</span>

                    <span class="k">this</span><span class="o">.</span><span class="nx">_createRootNodeStructure</span><span class="o">();</span>

                    <span class="nx">oConfig</span><span class="o">.</span><span class="nx">setProperty</span><span class="o">(</span><span class="s2">&quot;text&quot;</span><span class="o">,</span> <span class="nx">p_oObject</span><span class="o">.</span><span class="nx">text</span><span class="o">);</span>

                    <span class="k">this</span><span class="o">.</span><span class="nx">srcElement</span> <span class="o">=</span> <span class="nx">p_oObject</span><span class="o">;</span>

                <span class="k">break</span><span class="o">;</span>

                <span class="nx">case</span> <span class="s2">&quot;OPTGROUP&quot;</span><span class="o">:</span>

                    <span class="k">this</span><span class="o">.</span><span class="nx">_createRootNodeStructure</span><span class="o">();</span>

                    <span class="nx">oConfig</span><span class="o">.</span><span class="nx">setProperty</span><span class="o">(</span><span class="s2">&quot;text&quot;</span><span class="o">,</span> <span class="nx">p_oObject</span><span class="o">.</span><span class="k">label</span><span class="o">);</span>

                    <span class="k">this</span><span class="o">.</span><span class="nx">srcElement</span> <span class="o">=</span> <span class="nx">p_oObject</span><span class="o">;</span>

                    <span class="k">this</span><span class="o">.</span><span class="nx">_initSubTree</span><span class="o">();</span>

                <span class="k">break</span><span class="o">;</span>

                <span class="nx">case</span> <span class="s2">&quot;LI&quot;</span><span class="o">:</span>

                    <span class="c">// Get the anchor node (if it exists)</span>
<span class="c"></span>
                    <span class="k">var</span> <span class="nx">oAnchor</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">_getFirstElement</span><span class="o">(</span><span class="nx">p_oObject</span><span class="o">,</span> <span class="s2">&quot;A&quot;</span><span class="o">),</span>
                        <span class="nx">sURL</span> <span class="o">=</span> <span class="s2">&quot;#&quot;</span><span class="o">,</span>
                        <span class="nx">sTarget</span><span class="o">,</span>
                        <span class="nx">sText</span><span class="o">;</span>


                    <span class="c">// Capture the &quot;text&quot; and/or the &quot;URL&quot;</span>
<span class="c"></span>
                    <span class="k">if</span><span class="o">(</span><span class="nx">oAnchor</span><span class="o">)</span> <span class="o">{</span>

                        <span class="nx">sURL</span> <span class="o">=</span> <span class="nx">oAnchor</span><span class="o">.</span><span class="nx">getAttribute</span><span class="o">(</span><span class="s2">&quot;href&quot;</span><span class="o">);</span>
                        <span class="nx">sTarget</span> <span class="o">=</span> <span class="nx">oAnchor</span><span class="o">.</span><span class="nx">getAttribute</span><span class="o">(</span><span class="s2">&quot;target&quot;</span><span class="o">);</span>

                        <span class="k">if</span><span class="o">(</span><span class="nx">oAnchor</span><span class="o">.</span><span class="nx">innerText</span><span class="o">)</span> <span class="o">{</span>
                
                            <span class="nx">sText</span> <span class="o">=</span> <span class="nx">oAnchor</span><span class="o">.</span><span class="nx">innerText</span><span class="o">;</span>
                
                        <span class="o">}</span>
                        <span class="k">else</span> <span class="o">{</span>
                
                            <span class="k">var</span> <span class="nx">oRange</span> <span class="o">=</span> <span class="nx">oAnchor</span><span class="o">.</span><span class="nx">ownerDocument</span><span class="o">.</span><span class="nx">createRange</span><span class="o">();</span>
                
                            <span class="nx">oRange</span><span class="o">.</span><span class="nx">selectNodeContents</span><span class="o">(</span><span class="nx">oAnchor</span><span class="o">);</span>
                
                            <span class="nx">sText</span> <span class="o">=</span> <span class="nx">oRange</span><span class="o">.</span><span class="nx">toString</span><span class="o">();</span>             
                
                        <span class="o">}</span>

                    <span class="o">}</span>
                    <span class="k">else</span> <span class="o">{</span>

                        <span class="k">var</span> <span class="nx">oText</span> <span class="o">=</span> <span class="nx">p_oObject</span><span class="o">.</span><span class="nx">firstChild</span><span class="o">;</span>

                        <span class="nx">sText</span> <span class="o">=</span> <span class="nx">oText</span><span class="o">.</span><span class="nx">nodeValue</span><span class="o">;</span>

                        <span class="nx">oAnchor</span> <span class="o">=</span> <span class="nb">document</span><span class="o">.</span><span class="nx">createElement</span><span class="o">(</span><span class="s2">&quot;a&quot;</span><span class="o">);</span>
                        
                        <span class="nx">oAnchor</span><span class="o">.</span><span class="nx">setAttribute</span><span class="o">(</span><span class="s2">&quot;href&quot;</span><span class="o">,</span> <span class="nx">sURL</span><span class="o">);</span>

                        <span class="nx">p_oObject</span><span class="o">.</span><span class="nx">replaceChild</span><span class="o">(</span><span class="nx">oAnchor</span><span class="o">,</span> <span class="nx">oText</span><span class="o">);</span>
                        
                        <span class="nx">oAnchor</span><span class="o">.</span><span class="nx">appendChild</span><span class="o">(</span><span class="nx">oText</span><span class="o">);</span>

                    <span class="o">}</span>


                    <span class="k">this</span><span class="o">.</span><span class="nx">srcElement</span> <span class="o">=</span> <span class="nx">p_oObject</span><span class="o">;</span>
                    <span class="k">this</span><span class="o">.</span><span class="nx">element</span> <span class="o">=</span> <span class="nx">p_oObject</span><span class="o">;</span>
                    <span class="k">this</span><span class="o">.</span><span class="nx">_oAnchor</span> <span class="o">=</span> <span class="nx">oAnchor</span><span class="o">;</span>
    

                    <span class="c">// Check if emphasis has been applied to the MenuItem</span>
<span class="c"></span>
                    <span class="k">var</span> <span class="nx">oEmphasisNode</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">_getFirstElement</span><span class="o">(</span><span class="nx">oAnchor</span><span class="o">),</span>
                        <span class="nx">bEmphasis</span> <span class="o">=</span> <span class="kc">false</span><span class="o">,</span>
                        <span class="nx">bStrongEmphasis</span> <span class="o">=</span> <span class="kc">false</span><span class="o">;</span>

                    <span class="k">if</span><span class="o">(</span><span class="nx">oEmphasisNode</span><span class="o">)</span> <span class="o">{</span>

                        <span class="c">// Set a reference to the text node </span>
<span class="c"></span>
                        <span class="k">this</span><span class="o">.</span><span class="nx">_oText</span> <span class="o">=</span> <span class="nx">oEmphasisNode</span><span class="o">.</span><span class="nx">firstChild</span><span class="o">;</span>

                        <span class="nx">switch</span><span class="o">(</span><span class="nx">oEmphasisNode</span><span class="o">.</span><span class="nx">tagName</span><span class="o">.</span><span class="nx">toUpperCase</span><span class="o">())</span> <span class="o">{</span>

                            <span class="nx">case</span> <span class="s2">&quot;EM&quot;</span><span class="o">:</span>

                                <span class="nx">bEmphasis</span> <span class="o">=</span> <span class="kc">true</span><span class="o">;</span>

                            <span class="k">break</span><span class="o">;</span>

                            <span class="nx">case</span> <span class="s2">&quot;STRONG&quot;</span><span class="o">:</span>

                                <span class="nx">bStrongEmphasis</span> <span class="o">=</span> <span class="kc">true</span><span class="o">;</span>

                            <span class="k">break</span><span class="o">;</span>

                        <span class="o">}</span>

                    <span class="o">}</span>
                    <span class="k">else</span> <span class="o">{</span>

                        <span class="c">// Set a reference to the text node </span>
<span class="c"></span>
                        <span class="k">this</span><span class="o">.</span><span class="nx">_oText</span> <span class="o">=</span> <span class="nx">oAnchor</span><span class="o">.</span><span class="nx">firstChild</span><span class="o">;</span>

                    <span class="o">}</span>


                    <span class="c">/*</span>
<span class="c">                        Set these properties silently to sync up the </span>
<span class="c">                        configuration object without making changes to the </span>
<span class="c">                        element&#39;s DOM</span>
<span class="c">                    */</span> 

                    <span class="nx">oConfig</span><span class="o">.</span><span class="nx">setProperty</span><span class="o">(</span><span class="s2">&quot;text&quot;</span><span class="o">,</span> <span class="nx">sText</span><span class="o">,</span> <span class="kc">true</span><span class="o">);</span>
                    <span class="nx">oConfig</span><span class="o">.</span><span class="nx">setProperty</span><span class="o">(</span><span class="s2">&quot;url&quot;</span><span class="o">,</span> <span class="nx">sURL</span><span class="o">,</span> <span class="kc">true</span><span class="o">);</span>
                    <span class="nx">oConfig</span><span class="o">.</span><span class="nx">setProperty</span><span class="o">(</span><span class="s2">&quot;target&quot;</span><span class="o">,</span> <span class="nx">sTarget</span><span class="o">,</span> <span class="kc">true</span><span class="o">);</span>
                    <span class="nx">oConfig</span><span class="o">.</span><span class="nx">setProperty</span><span class="o">(</span><span class="s2">&quot;emphasis&quot;</span><span class="o">,</span> <span class="nx">bEmphasis</span><span class="o">,</span> <span class="kc">true</span><span class="o">);</span>
                    <span class="nx">oConfig</span><span class="o">.</span><span class="nx">setProperty</span><span class="o">(</span>
                        <span class="s2">&quot;strongemphasis&quot;</span><span class="o">,</span> 
                        <span class="nx">bStrongEmphasis</span><span class="o">,</span> 
                        <span class="kc">true</span>
                    <span class="o">);</span>

                    <span class="k">this</span><span class="o">.</span><span class="nx">_initSubTree</span><span class="o">();</span>

                <span class="k">break</span><span class="o">;</span>

            <span class="o">}</span>            

        <span class="o">}</span>


        <span class="k">if</span><span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">element</span><span class="o">)</span> <span class="o">{</span>


            <span class="nx">Dom</span><span class="o">.</span><span class="nx">addClass</span><span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">element</span><span class="o">,</span> <span class="k">this</span><span class="o">.</span><span class="nx">CSS_CLASS_NAME</span><span class="o">);</span>


            <span class="c">// Create custom events</span>
<span class="c"></span>    
            <span class="k">var</span> <span class="nx">CustomEvent</span> <span class="o">=</span> <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">util</span><span class="o">.</span><span class="nx">CustomEvent</span><span class="o">;</span>
    
            <span class="k">this</span><span class="o">.</span><span class="nx">destroyEvent</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">CustomEvent</span><span class="o">(</span><span class="s2">&quot;destroyEvent&quot;</span><span class="o">,</span> <span class="k">this</span><span class="o">);</span>
            <span class="k">this</span><span class="o">.</span><span class="nx">mouseOverEvent</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">CustomEvent</span><span class="o">(</span><span class="s2">&quot;mouseOverEvent&quot;</span><span class="o">,</span> <span class="k">this</span><span class="o">);</span>
            <span class="k">this</span><span class="o">.</span><span class="nx">mouseOutEvent</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">CustomEvent</span><span class="o">(</span><span class="s2">&quot;mouseOutEvent&quot;</span><span class="o">,</span> <span class="k">this</span><span class="o">);</span>
            <span class="k">this</span><span class="o">.</span><span class="nx">mouseDownEvent</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">CustomEvent</span><span class="o">(</span><span class="s2">&quot;mouseDownEvent&quot;</span><span class="o">,</span> <span class="k">this</span><span class="o">);</span>
            <span class="k">this</span><span class="o">.</span><span class="nx">mouseUpEvent</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">CustomEvent</span><span class="o">(</span><span class="s2">&quot;mouseUpEvent&quot;</span><span class="o">,</span> <span class="k">this</span><span class="o">);</span>
            <span class="k">this</span><span class="o">.</span><span class="nx">clickEvent</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">CustomEvent</span><span class="o">(</span><span class="s2">&quot;clickEvent&quot;</span><span class="o">,</span> <span class="k">this</span><span class="o">);</span>
            <span class="k">this</span><span class="o">.</span><span class="nx">keyPressEvent</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">CustomEvent</span><span class="o">(</span><span class="s2">&quot;keyPressEvent&quot;</span><span class="o">,</span> <span class="k">this</span><span class="o">);</span>
            <span class="k">this</span><span class="o">.</span><span class="nx">keyDownEvent</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">CustomEvent</span><span class="o">(</span><span class="s2">&quot;keyDownEvent&quot;</span><span class="o">,</span> <span class="k">this</span><span class="o">);</span>
            <span class="k">this</span><span class="o">.</span><span class="nx">keyUpEvent</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">CustomEvent</span><span class="o">(</span><span class="s2">&quot;keyUpEvent&quot;</span><span class="o">,</span> <span class="k">this</span><span class="o">);</span>
            <span class="k">this</span><span class="o">.</span><span class="nx">focusEvent</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">CustomEvent</span><span class="o">(</span><span class="s2">&quot;focusEvent&quot;</span><span class="o">,</span> <span class="k">this</span><span class="o">);</span>
            <span class="k">this</span><span class="o">.</span><span class="nx">blurEvent</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">CustomEvent</span><span class="o">(</span><span class="s2">&quot;blurEvent&quot;</span><span class="o">,</span> <span class="k">this</span><span class="o">);</span>


            <span class="k">if</span><span class="o">(</span><span class="nx">p_oConfig</span><span class="o">)</span> <span class="o">{</span>
    
                <span class="nx">oConfig</span><span class="o">.</span><span class="nx">applyConfig</span><span class="o">(</span><span class="nx">p_oConfig</span><span class="o">);</span>
    
            <span class="o">}</span>        

            <span class="nx">oConfig</span><span class="o">.</span><span class="nx">fireQueue</span><span class="o">();</span>

        <span class="o">}</span>

    <span class="o">},</span>



    <span class="c">// Private methods</span>
<span class="c"></span>
    <span class="c">/**</span>
<span class="c">    * @method _getFirstElement</span>
<span class="c">    * @description Returns an HTML element&#39;s first HTML element node.</span>
<span class="c">    * @private</span>
<span class="c">    * @param {&lt;a href=&quot;http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/</span>
<span class="c">    * level-one-html.html#ID-58190037&quot;&gt;HTMLElement&lt;/a&gt;} p_oElement Object </span>
<span class="c">    * reference specifying the element to be evaluated.</span>
<span class="c">    * @param {String} p_sTagName Optional. String specifying the tagname of </span>
<span class="c">    * the element to be retrieved.</span>
<span class="c">    * @return {&lt;a href=&quot;http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/</span>
<span class="c">    * level-one-html.html#ID-58190037&quot;&gt;HTMLElement&lt;/a&gt;}</span>
<span class="c">    */</span>
    <span class="nx">_getFirstElement</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">p_oElement</span><span class="o">,</span> <span class="nx">p_sTagName</span><span class="o">)</span> <span class="o">{</span>

        <span class="k">var</span> <span class="nx">oElement</span><span class="o">;</span>

        <span class="k">if</span><span class="o">(</span><span class="nx">p_oElement</span><span class="o">.</span><span class="nx">firstChild</span> <span class="o">&amp;&amp;</span> <span class="nx">p_oElement</span><span class="o">.</span><span class="nx">firstChild</span><span class="o">.</span><span class="nx">nodeType</span> <span class="o">==</span> <span class="m">1</span><span class="o">)</span> <span class="o">{</span>

            <span class="nx">oElement</span> <span class="o">=</span> <span class="nx">p_oElement</span><span class="o">.</span><span class="nx">firstChild</span><span class="o">;</span>

        <span class="o">}</span>
        <span class="k">else</span> <span class="k">if</span><span class="o">(</span>
            <span class="nx">p_oElement</span><span class="o">.</span><span class="nx">firstChild</span> <span class="o">&amp;&amp;</span> 
            <span class="nx">p_oElement</span><span class="o">.</span><span class="nx">firstChild</span><span class="o">.</span><span class="nx">nextSibling</span> <span class="o">&amp;&amp;</span> 
            <span class="nx">p_oElement</span><span class="o">.</span><span class="nx">firstChild</span><span class="o">.</span><span class="nx">nextSibling</span><span class="o">.</span><span class="nx">nodeType</span> <span class="o">==</span> <span class="m">1</span>
        <span class="o">)</span> <span class="o">{</span>

            <span class="nx">oElement</span> <span class="o">=</span> <span class="nx">p_oElement</span><span class="o">.</span><span class="nx">firstChild</span><span class="o">.</span><span class="nx">nextSibling</span><span class="o">;</span>

        <span class="o">}</span>


        <span class="k">if</span><span class="o">(</span><span class="nx">p_sTagName</span><span class="o">)</span> <span class="o">{</span>

            <span class="k">return</span> <span class="o">(</span><span class="nx">oElement</span> <span class="o">&amp;&amp;</span> <span class="nx">oElement</span><span class="o">.</span><span class="nx">tagName</span><span class="o">.</span><span class="nx">toUpperCase</span><span class="o">()</span> <span class="o">==</span> <span class="nx">p_sTagName</span><span class="o">)</span> <span class="o">?</span> 
                <span class="nx">oElement</span> <span class="o">:</span> <span class="kc">false</span><span class="o">;</span>

        <span class="o">}</span>

        <span class="k">return</span> <span class="nx">oElement</span><span class="o">;</span>

    <span class="o">},</span>


    <span class="c">/**</span>
<span class="c">    * @method _checkString</span>
<span class="c">    * @description Determines if an object is a string.</span>
<span class="c">    * @private</span>
<span class="c">    * @param {Object} p_oObject Object to be evaluated.</span>
<span class="c">    * @return {Boolean}</span>
<span class="c">    */</span>
    <span class="nx">_checkString</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">p_oObject</span><span class="o">)</span> <span class="o">{</span>

        <span class="k">return</span> <span class="o">(</span><span class="k">typeof</span> <span class="nx">p_oObject</span> <span class="o">==</span> <span class="s2">&quot;string&quot;</span><span class="o">);</span>

    <span class="o">},</span>


    <span class="c">/**</span>
<span class="c">    * @method _checkDOMNode</span>
<span class="c">    * @description Determines if an object is an HTML element.</span>
<span class="c">    * @private</span>
<span class="c">    * @param {Object} p_oObject Object to be evaluated.</span>
<span class="c">    * @return {Boolean}</span>
<span class="c">    */</span>
    <span class="nx">_checkDOMNode</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">p_oObject</span><span class="o">)</span> <span class="o">{</span>

        <span class="k">return</span> <span class="o">(</span><span class="nx">p_oObject</span> <span class="o">&amp;&amp;</span> <span class="nx">p_oObject</span><span class="o">.</span><span class="nx">tagName</span><span class="o">);</span>

    <span class="o">},</span>


    <span class="c">/**</span>
<span class="c">    * @method _createRootNodeStructure</span>
<span class="c">    * @description Creates the core DOM structure for the menu item.</span>
<span class="c">    * @private</span>
<span class="c">    */</span>
    <span class="nx">_createRootNodeStructure</span><span class="o">:</span> <span class="k">function</span> <span class="o">()</span> <span class="o">{</span>

        <span class="k">this</span><span class="o">.</span><span class="nx">element</span> <span class="o">=</span> <span class="nb">document</span><span class="o">.</span><span class="nx">createElement</span><span class="o">(</span><span class="s2">&quot;li&quot;</span><span class="o">);</span>

        <span class="k">this</span><span class="o">.</span><span class="nx">_oText</span> <span class="o">=</span> <span class="nb">document</span><span class="o">.</span><span class="nx">createTextNode</span><span class="o">(</span><span class="s2">&quot;&quot;</span><span class="o">);</span>

        <span class="k">this</span><span class="o">.</span><span class="nx">_oAnchor</span> <span class="o">=</span> <span class="nb">document</span><span class="o">.</span><span class="nx">createElement</span><span class="o">(</span><span class="s2">&quot;a&quot;</span><span class="o">);</span>
        <span class="k">this</span><span class="o">.</span><span class="nx">_oAnchor</span><span class="o">.</span><span class="nx">appendChild</span><span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">_oText</span><span class="o">);</span>
        
        <span class="k">this</span><span class="o">.</span><span class="nx">cfg</span><span class="o">.</span><span class="nx">refireEvent</span><span class="o">(</span><span class="s2">&quot;url&quot;</span><span class="o">);</span>

        <span class="k">this</span><span class="o">.</span><span class="nx">element</span><span class="o">.</span><span class="nx">appendChild</span><span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">_oAnchor</span><span class="o">);</span>            

    <span class="o">},</span>


    <span class="c">/**</span>
<span class="c">    * @method _initSubTree</span>
<span class="c">    * @description Iterates the source element&#39;s childNodes collection and uses </span>
<span class="c">    * the child nodes to instantiate other menus.</span>
<span class="c">    * @private</span>
<span class="c">    */</span>
    <span class="nx">_initSubTree</span><span class="o">:</span> <span class="k">function</span><span class="o">()</span> <span class="o">{</span>

        <span class="k">var</span> <span class="nx">oSrcEl</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">srcElement</span><span class="o">,</span>
            <span class="nx">oConfig</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">cfg</span><span class="o">;</span>


        <span class="k">if</span><span class="o">(</span><span class="nx">oSrcEl</span><span class="o">.</span><span class="nx">childNodes</span><span class="o">.</span><span class="nx">length</span> <span class="o">&gt;</span> <span class="m">0</span><span class="o">)</span> <span class="o">{</span>

            <span class="k">if</span><span class="o">(</span>
                <span class="k">this</span><span class="o">.</span><span class="nx">parent</span><span class="o">.</span><span class="nx">lazyLoad</span> <span class="o">&amp;&amp;</span> 
                <span class="k">this</span><span class="o">.</span><span class="nx">parent</span><span class="o">.</span><span class="nx">srcElement</span> <span class="o">&amp;&amp;</span> 
                <span class="k">this</span><span class="o">.</span><span class="nx">parent</span><span class="o">.</span><span class="nx">srcElement</span><span class="o">.</span><span class="nx">tagName</span><span class="o">.</span><span class="nx">toUpperCase</span><span class="o">()</span> <span class="o">==</span> <span class="s2">&quot;SELECT&quot;</span>
            <span class="o">)</span> <span class="o">{</span>

                <span class="nx">oConfig</span><span class="o">.</span><span class="nx">setProperty</span><span class="o">(</span>
                        <span class="s2">&quot;submenu&quot;</span><span class="o">,</span> 
                        <span class="o">{</span> <span class="nx">id</span><span class="o">:</span> <span class="nx">Dom</span><span class="o">.</span><span class="nx">generateId</span><span class="o">(),</span> <span class="nx">itemdata</span><span class="o">:</span> <span class="nx">oSrcEl</span><span class="o">.</span><span class="nx">childNodes</span> <span class="o">}</span>
                    <span class="o">);</span>

            <span class="o">}</span>
            <span class="k">else</span> <span class="o">{</span>

                <span class="k">var</span> <span class="nx">oNode</span> <span class="o">=</span> <span class="nx">oSrcEl</span><span class="o">.</span><span class="nx">firstChild</span><span class="o">,</span>
                    <span class="nx">aOptions</span> <span class="o">=</span> <span class="o">[];</span>
    
                <span class="k">do</span> <span class="o">{</span>
    
                    <span class="k">if</span><span class="o">(</span><span class="nx">oNode</span> <span class="o">&amp;&amp;</span> <span class="nx">oNode</span><span class="o">.</span><span class="nx">tagName</span><span class="o">)</span> <span class="o">{</span>
    
                        <span class="nx">switch</span><span class="o">(</span><span class="nx">oNode</span><span class="o">.</span><span class="nx">tagName</span><span class="o">.</span><span class="nx">toUpperCase</span><span class="o">())</span> <span class="o">{</span>
                
                            <span class="nx">case</span> <span class="s2">&quot;DIV&quot;</span><span class="o">:</span>
                
                                <span class="nx">oConfig</span><span class="o">.</span><span class="nx">setProperty</span><span class="o">(</span><span class="s2">&quot;submenu&quot;</span><span class="o">,</span> <span class="nx">oNode</span><span class="o">);</span>
                
                            <span class="k">break</span><span class="o">;</span>
         
                            <span class="nx">case</span> <span class="s2">&quot;OPTION&quot;</span><span class="o">:</span>
        
                                <span class="nx">aOptions</span><span class="o">[</span><span class="nx">aOptions</span><span class="o">.</span><span class="nx">length</span><span class="o">]</span> <span class="o">=</span> <span class="nx">oNode</span><span class="o">;</span>
        
                            <span class="k">break</span><span class="o">;</span>
               
                        <span class="o">}</span>
                    
                    <span class="o">}</span>
                
                <span class="o">}</span>        
                <span class="k">while</span><span class="o">((</span><span class="nx">oNode</span> <span class="o">=</span> <span class="nx">oNode</span><span class="o">.</span><span class="nx">nextSibling</span><span class="o">));</span>
    
    
                <span class="k">var</span> <span class="nx">nOptions</span> <span class="o">=</span> <span class="nx">aOptions</span><span class="o">.</span><span class="nx">length</span><span class="o">;</span>
    
                <span class="k">if</span><span class="o">(</span><span class="nx">nOptions</span> <span class="o">&gt;</span> <span class="m">0</span><span class="o">)</span> <span class="o">{</span>
    
                    <span class="k">var</span> <span class="nx">oMenu</span> <span class="o">=</span> <span class="k">new</span> <span class="k">this</span><span class="o">.</span><span class="nx">SUBMENU_TYPE</span><span class="o">(</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">generateId</span><span class="o">());</span>
                    
                    <span class="nx">oConfig</span><span class="o">.</span><span class="nx">setProperty</span><span class="o">(</span><span class="s2">&quot;submenu&quot;</span><span class="o">,</span> <span class="nx">oMenu</span><span class="o">);</span>
    
                    <span class="k">for</span><span class="o">(</span><span class="k">var</span> <span class="nx">n</span><span class="o">=</span><span class="m">0</span><span class="o">;</span> <span class="nx">n</span><span class="o">&lt;</span><span class="nx">nOptions</span><span class="o">;</span> <span class="nx">n</span><span class="o">++)</span> <span class="o">{</span>
        
                        <span class="nx">oMenu</span><span class="o">.</span><span class="nx">addItem</span><span class="o">((</span><span class="k">new</span> <span class="nx">oMenu</span><span class="o">.</span><span class="nx">ITEM_TYPE</span><span class="o">(</span><span class="nx">aOptions</span><span class="o">[</span><span class="nx">n</span><span class="o">])));</span>
        
                    <span class="o">}</span>
        
                <span class="o">}</span>
            
            <span class="o">}</span>

        <span class="o">}</span>

    <span class="o">},</span>


    <span class="c">/**</span>
<span class="c">    * @method _preloadImage</span>
<span class="c">    * @description Preloads an image by creating an image element from the </span>
<span class="c">    * specified path and appending the image to the body of the document.</span>
<span class="c">    * @private</span>
<span class="c">    * @param {String} p_sPath String specifying the path to the image.                </span>
<span class="c">    */</span>
    <span class="nx">_preloadImage</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">p_sPath</span><span class="o">)</span> <span class="o">{</span>

        <span class="k">var</span> <span class="nx">sPath</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">imageRoot</span> <span class="o">+</span> <span class="nx">p_sPath</span><span class="o">;</span>

        <span class="k">if</span><span class="o">(!</span><span class="nb">document</span><span class="o">.</span><span class="nx">images</span><span class="o">[</span><span class="nx">sPath</span><span class="o">])</span> <span class="o">{</span>

            <span class="k">var</span> <span class="nx">oImage</span> <span class="o">=</span> <span class="nb">document</span><span class="o">.</span><span class="nx">createElement</span><span class="o">(</span><span class="s2">&quot;img&quot;</span><span class="o">);</span>
            <span class="nx">oImage</span><span class="o">.</span><span class="nx">src</span> <span class="o">=</span> <span class="nx">sPath</span><span class="o">;</span>
            <span class="nx">oImage</span><span class="o">.</span><span class="nx">name</span> <span class="o">=</span> <span class="nx">sPath</span><span class="o">;</span>
            <span class="nx">oImage</span><span class="o">.</span><span class="nx">id</span> <span class="o">=</span> <span class="nx">sPath</span><span class="o">;</span>
            <span class="nx">oImage</span><span class="o">.</span><span class="nx">style</span><span class="o">.</span><span class="nx">display</span> <span class="o">=</span> <span class="s2">&quot;none&quot;</span><span class="o">;</span>
            
            <span class="nb">document</span><span class="o">.</span><span class="nx">body</span><span class="o">.</span><span class="nx">appendChild</span><span class="o">(</span><span class="nx">oImage</span><span class="o">);</span>

        <span class="o">}</span>
    
    <span class="o">},</span>



    <span class="c">// Event handlers for configuration properties</span>
<span class="c"></span>

    <span class="c">/**</span>
<span class="c">    * @method configText</span>
<span class="c">    * @description Event handler for when the &quot;text&quot; configuration property of </span>
<span class="c">    * the menu item changes.</span>
<span class="c">    * @param {String} p_sType String representing the name of the event that </span>
<span class="c">    * was fired.</span>
<span class="c">    * @param {Array} p_aArgs Array of arguments sent when the event was fired.</span>
<span class="c">    * @param {YAHOO.widget.MenuItem} p_oItem Object representing the menu item</span>
<span class="c">    * that fired the event.</span>
<span class="c">    */</span>
    <span class="nx">configText</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">p_sType</span><span class="o">,</span> <span class="nx">p_aArgs</span><span class="o">,</span> <span class="nx">p_oItem</span><span class="o">)</span> <span class="o">{</span>

        <span class="k">var</span> <span class="nx">sText</span> <span class="o">=</span> <span class="nx">p_aArgs</span><span class="o">[</span><span class="m">0</span><span class="o">];</span>


        <span class="k">if</span><span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">_oText</span><span class="o">)</span> <span class="o">{</span>

            <span class="k">this</span><span class="o">.</span><span class="nx">_oText</span><span class="o">.</span><span class="nx">nodeValue</span> <span class="o">=</span> <span class="nx">sText</span><span class="o">;</span>

        <span class="o">}</span>

    <span class="o">},</span>


    <span class="c">/**</span>
<span class="c">    * @method configHelpText</span>
<span class="c">    * @description Event handler for when the &quot;helptext&quot; configuration property </span>
<span class="c">    * of the menu item changes.</span>
<span class="c">    * @param {String} p_sType String representing the name of the event that </span>
<span class="c">    * was fired.</span>
<span class="c">    * @param {Array} p_aArgs Array of arguments sent when the event was fired.</span>
<span class="c">    * @param {YAHOO.widget.MenuItem} p_oItem Object representing the menu item</span>
<span class="c">    * that fired the event.</span>
<span class="c">    */</span>    
    <span class="nx">configHelpText</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">p_sType</span><span class="o">,</span> <span class="nx">p_aArgs</span><span class="o">,</span> <span class="nx">p_oItem</span><span class="o">)</span> <span class="o">{</span>

        <span class="k">var</span> <span class="nx">me</span> <span class="o">=</span> <span class="k">this</span><span class="o">,</span>
            <span class="nx">oHelpText</span> <span class="o">=</span> <span class="nx">p_aArgs</span><span class="o">[</span><span class="m">0</span><span class="o">],</span>
            <span class="nx">oEl</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">element</span><span class="o">,</span>
            <span class="nx">oConfig</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">cfg</span><span class="o">,</span>
            <span class="nx">aNodes</span> <span class="o">=</span> <span class="o">[</span><span class="nx">oEl</span><span class="o">,</span> <span class="k">this</span><span class="o">.</span><span class="nx">_oAnchor</span><span class="o">],</span>
            <span class="nx">oImg</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">submenuIndicator</span><span class="o">;</span>


        <span class="c">/**</span>
<span class="c">        * Adds the &quot;hashelptext&quot; class to the necessary nodes and refires the </span>
<span class="c">        * &quot;selected&quot; and &quot;disabled&quot; configuration events.</span>
<span class="c">        * @private</span>
<span class="c">        */</span>
        <span class="k">function</span> <span class="nx">initHelpText</span><span class="o">()</span> <span class="o">{</span>

            <span class="nx">Dom</span><span class="o">.</span><span class="nx">addClass</span><span class="o">(</span><span class="nx">aNodes</span><span class="o">,</span> <span class="s2">&quot;hashelptext&quot;</span><span class="o">);</span>

            <span class="k">if</span><span class="o">(</span><span class="nx">oConfig</span><span class="o">.</span><span class="nx">getProperty</span><span class="o">(</span><span class="s2">&quot;disabled&quot;</span><span class="o">))</span> <span class="o">{</span>

                <span class="nx">oConfig</span><span class="o">.</span><span class="nx">refireEvent</span><span class="o">(</span><span class="s2">&quot;disabled&quot;</span><span class="o">);</span>

            <span class="o">}</span>

            <span class="k">if</span><span class="o">(</span><span class="nx">oConfig</span><span class="o">.</span><span class="nx">getProperty</span><span class="o">(</span><span class="s2">&quot;selected&quot;</span><span class="o">))</span> <span class="o">{</span>

                <span class="nx">oConfig</span><span class="o">.</span><span class="nx">refireEvent</span><span class="o">(</span><span class="s2">&quot;selected&quot;</span><span class="o">);</span>

            <span class="o">}</span>                

        <span class="o">}</span>


        <span class="c">/**</span>
<span class="c">        * Removes the &quot;hashelptext&quot; class and corresponding DOM element (EM).</span>
<span class="c">        * @private</span>
<span class="c">        */</span>
        <span class="k">function</span> <span class="nx">removeHelpText</span><span class="o">()</span> <span class="o">{</span>

            <span class="nx">Dom</span><span class="o">.</span><span class="nx">removeClass</span><span class="o">(</span><span class="nx">aNodes</span><span class="o">,</span> <span class="s2">&quot;hashelptext&quot;</span><span class="o">);</span>

            <span class="nx">oEl</span><span class="o">.</span><span class="nx">removeChild</span><span class="o">(</span><span class="nx">me</span><span class="o">.</span><span class="nx">_oHelpTextEM</span><span class="o">);</span>
            <span class="nx">me</span><span class="o">.</span><span class="nx">_oHelpTextEM</span> <span class="o">=</span> <span class="kc">null</span><span class="o">;</span>

        <span class="o">}</span>


        <span class="k">if</span><span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">_checkDOMNode</span><span class="o">(</span><span class="nx">oHelpText</span><span class="o">))</span> <span class="o">{</span>

            <span class="k">if</span><span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">_oHelpTextEM</span><span class="o">)</span> <span class="o">{</span>

                <span class="k">this</span><span class="o">.</span><span class="nx">_oHelpTextEM</span><span class="o">.</span><span class="nx">parentNode</span><span class="o">.</span><span class="nx">replaceChild</span><span class="o">(</span>
                    <span class="nx">oHelpText</span><span class="o">,</span> 
                    <span class="k">this</span><span class="o">.</span><span class="nx">_oHelpTextEM</span>
                <span class="o">);</span>

            <span class="o">}</span>
            <span class="k">else</span> <span class="o">{</span>

                <span class="k">this</span><span class="o">.</span><span class="nx">_oHelpTextEM</span> <span class="o">=</span> <span class="nx">oHelpText</span><span class="o">;</span>

                <span class="nx">oEl</span><span class="o">.</span><span class="nx">insertBefore</span><span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">_oHelpTextEM</span><span class="o">,</span> <span class="nx">oImg</span><span class="o">);</span>

            <span class="o">}</span>

            <span class="nx">initHelpText</span><span class="o">();</span>

        <span class="o">}</span>
        <span class="k">else</span> <span class="k">if</span><span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">_checkString</span><span class="o">(</span><span class="nx">oHelpText</span><span class="o">))</span> <span class="o">{</span>

            <span class="k">if</span><span class="o">(</span><span class="nx">oHelpText</span><span class="o">.</span><span class="nx">length</span> <span class="o">===</span> <span class="m">0</span><span class="o">)</span> <span class="o">{</span>

                <span class="nx">removeHelpText</span><span class="o">();</span>

            <span class="o">}</span>
            <span class="k">else</span> <span class="o">{</span>

                <span class="k">if</span><span class="o">(!</span><span class="k">this</span><span class="o">.</span><span class="nx">_oHelpTextEM</span><span class="o">)</span> <span class="o">{</span>

                    <span class="k">this</span><span class="o">.</span><span class="nx">_oHelpTextEM</span> <span class="o">=</span> <span class="nb">document</span><span class="o">.</span><span class="nx">createElement</span><span class="o">(</span><span class="s2">&quot;em&quot;</span><span class="o">);</span>

                    <span class="nx">oEl</span><span class="o">.</span><span class="nx">insertBefore</span><span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">_oHelpTextEM</span><span class="o">,</span> <span class="nx">oImg</span><span class="o">);</span>

                <span class="o">}</span>

                <span class="k">this</span><span class="o">.</span><span class="nx">_oHelpTextEM</span><span class="o">.</span><span class="nx">innerHTML</span> <span class="o">=</span> <span class="nx">oHelpText</span><span class="o">;</span>

                <span class="nx">initHelpText</span><span class="o">();</span>

            <span class="o">}</span>

        <span class="o">}</span>
        <span class="k">else</span> <span class="k">if</span><span class="o">(!</span><span class="nx">oHelpText</span> <span class="o">&amp;&amp;</span> <span class="k">this</span><span class="o">.</span><span class="nx">_oHelpTextEM</span><span class="o">)</span> <span class="o">{</span>

            <span class="nx">removeHelpText</span><span class="o">();</span>

        <span class="o">}</span>

    <span class="o">},</span>


    <span class="c">/**</span>
<span class="c">    * @method configURL</span>
<span class="c">    * @description Event handler for when the &quot;url&quot; configuration property of </span>
<span class="c">    * the menu item changes.</span>
<span class="c">    * @param {String} p_sType String representing the name of the event that </span>
<span class="c">    * was fired.</span>
<span class="c">    * @param {Array} p_aArgs Array of arguments sent when the event was fired.</span>
<span class="c">    * @param {YAHOO.widget.MenuItem} p_oItem Object representing the menu item</span>
<span class="c">    * that fired the event.</span>
<span class="c">    */</span>    
    <span class="nx">configURL</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">p_sType</span><span class="o">,</span> <span class="nx">p_aArgs</span><span class="o">,</span> <span class="nx">p_oItem</span><span class="o">)</span> <span class="o">{</span>

        <span class="k">var</span> <span class="nx">sURL</span> <span class="o">=</span> <span class="nx">p_aArgs</span><span class="o">[</span><span class="m">0</span><span class="o">];</span>

        <span class="k">if</span><span class="o">(!</span><span class="nx">sURL</span><span class="o">)</span> <span class="o">{</span>

            <span class="nx">sURL</span> <span class="o">=</span> <span class="s2">&quot;#&quot;</span><span class="o">;</span>

        <span class="o">}</span>

        <span class="k">this</span><span class="o">.</span><span class="nx">_oAnchor</span><span class="o">.</span><span class="nx">setAttribute</span><span class="o">(</span><span class="s2">&quot;href&quot;</span><span class="o">,</span> <span class="nx">sURL</span><span class="o">);</span>

    <span class="o">},</span>


    <span class="c">/**</span>
<span class="c">    * @method configTarget</span>
<span class="c">    * @description Event handler for when the &quot;target&quot; configuration property </span>
<span class="c">    * of the menu item changes.  </span>
<span class="c">    * @param {String} p_sType String representing the name of the event that </span>
<span class="c">    * was fired.</span>
<span class="c">    * @param {Array} p_aArgs Array of arguments sent when the event was fired.</span>
<span class="c">    * @param {YAHOO.widget.MenuItem} p_oItem Object representing the menu item</span>
<span class="c">    * that fired the event.</span>
<span class="c">    */</span>    
    <span class="nx">configTarget</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">p_sType</span><span class="o">,</span> <span class="nx">p_aArgs</span><span class="o">,</span> <span class="nx">p_oItem</span><span class="o">)</span> <span class="o">{</span>

        <span class="k">var</span> <span class="nx">sTarget</span> <span class="o">=</span> <span class="nx">p_aArgs</span><span class="o">[</span><span class="m">0</span><span class="o">],</span>
            <span class="nx">oAnchor</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">_oAnchor</span><span class="o">;</span>

        <span class="k">if</span><span class="o">(</span><span class="nx">sTarget</span> <span class="o">&amp;&amp;</span> <span class="nx">sTarget</span><span class="o">.</span><span class="nx">length</span> <span class="o">&gt;</span> <span class="m">0</span><span class="o">)</span> <span class="o">{</span>

            <span class="nx">oAnchor</span><span class="o">.</span><span class="nx">setAttribute</span><span class="o">(</span><span class="s2">&quot;target&quot;</span><span class="o">,</span> <span class="nx">sTarget</span><span class="o">);</span>

        <span class="o">}</span>
        <span class="k">else</span> <span class="o">{</span>

            <span class="nx">oAnchor</span><span class="o">.</span><span class="nx">removeAttribute</span><span class="o">(</span><span class="s2">&quot;target&quot;</span><span class="o">);</span>
        
        <span class="o">}</span>

    <span class="o">},</span>


    <span class="c">/**</span>
<span class="c">    * @method configEmphasis</span>
<span class="c">    * @description Event handler for when the &quot;emphasis&quot; configuration property</span>
<span class="c">    * of the menu item changes.  </span>
<span class="c">    * @param {String} p_sType String representing the name of the event that </span>
<span class="c">    * was fired.</span>
<span class="c">    * @param {Array} p_aArgs Array of arguments sent when the event was fired.</span>
<span class="c">    * @param {YAHOO.widget.MenuItem} p_oItem Object representing the menu item</span>
<span class="c">    * that fired the event.</span>
<span class="c">    */</span>    
    <span class="nx">configEmphasis</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">p_sType</span><span class="o">,</span> <span class="nx">p_aArgs</span><span class="o">,</span> <span class="nx">p_oItem</span><span class="o">)</span> <span class="o">{</span>

        <span class="k">var</span> <span class="nx">bEmphasis</span> <span class="o">=</span> <span class="nx">p_aArgs</span><span class="o">[</span><span class="m">0</span><span class="o">],</span>
            <span class="nx">oAnchor</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">_oAnchor</span><span class="o">,</span>
            <span class="nx">oText</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">_oText</span><span class="o">,</span>
            <span class="nx">oConfig</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">cfg</span><span class="o">,</span>
            <span class="nx">oEM</span><span class="o">;</span>


        <span class="k">if</span><span class="o">(</span><span class="nx">bEmphasis</span> <span class="o">&amp;&amp;</span> <span class="nx">oConfig</span><span class="o">.</span><span class="nx">getProperty</span><span class="o">(</span><span class="s2">&quot;strongemphasis&quot;</span><span class="o">))</span> <span class="o">{</span>

            <span class="nx">oConfig</span><span class="o">.</span><span class="nx">setProperty</span><span class="o">(</span><span class="s2">&quot;strongemphasis&quot;</span><span class="o">,</span> <span class="kc">false</span><span class="o">);</span>

        <span class="o">}</span>


        <span class="k">if</span><span class="o">(</span><span class="nx">oAnchor</span><span class="o">)</span> <span class="o">{</span>

            <span class="k">if</span><span class="o">(</span><span class="nx">bEmphasis</span><span class="o">)</span> <span class="o">{</span>

                <span class="nx">oEM</span> <span class="o">=</span> <span class="nb">document</span><span class="o">.</span><span class="nx">createElement</span><span class="o">(</span><span class="s2">&quot;em&quot;</span><span class="o">);</span>
                <span class="nx">oEM</span><span class="o">.</span><span class="nx">appendChild</span><span class="o">(</span><span class="nx">oText</span><span class="o">);</span>

                <span class="nx">oAnchor</span><span class="o">.</span><span class="nx">appendChild</span><span class="o">(</span><span class="nx">oEM</span><span class="o">);</span>

            <span class="o">}</span>
            <span class="k">else</span> <span class="o">{</span>

                <span class="nx">oEM</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">_getFirstElement</span><span class="o">(</span><span class="nx">oAnchor</span><span class="o">,</span> <span class="s2">&quot;EM&quot;</span><span class="o">);</span>

                <span class="k">if</span><span class="o">(</span><span class="nx">oEM</span><span class="o">)</span> <span class="o">{</span>

                    <span class="nx">oAnchor</span><span class="o">.</span><span class="nx">removeChild</span><span class="o">(</span><span class="nx">oEM</span><span class="o">);</span>
                    <span class="nx">oAnchor</span><span class="o">.</span><span class="nx">appendChild</span><span class="o">(</span><span class="nx">oText</span><span class="o">);</span>

                <span class="o">}</span>

            <span class="o">}</span>

        <span class="o">}</span>

    <span class="o">},</span>


    <span class="c">/**</span>
<span class="c">    * @method configStrongEmphasis</span>
<span class="c">    * @description Event handler for when the &quot;strongemphasis&quot; configuration </span>
<span class="c">    * property of the menu item changes. </span>
<span class="c">    * @param {String} p_sType String representing the name of the event that </span>
<span class="c">    * was fired.</span>
<span class="c">    * @param {Array} p_aArgs Array of arguments sent when the event was fired.</span>
<span class="c">    * @param {YAHOO.widget.MenuItem} p_oItem Object representing the menu item</span>
<span class="c">    * that fired the event.</span>
<span class="c">    */</span>    
    <span class="nx">configStrongEmphasis</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">p_sType</span><span class="o">,</span> <span class="nx">p_aArgs</span><span class="o">,</span> <span class="nx">p_oItem</span><span class="o">)</span> <span class="o">{</span>

        <span class="k">var</span> <span class="nx">bStrongEmphasis</span> <span class="o">=</span> <span class="nx">p_aArgs</span><span class="o">[</span><span class="m">0</span><span class="o">],</span>
            <span class="nx">oAnchor</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">_oAnchor</span><span class="o">,</span>
            <span class="nx">oText</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">_oText</span><span class="o">,</span>
            <span class="nx">oConfig</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">cfg</span><span class="o">,</span>
            <span class="nx">oStrong</span><span class="o">;</span>

        <span class="k">if</span><span class="o">(</span><span class="nx">bStrongEmphasis</span> <span class="o">&amp;&amp;</span> <span class="nx">oConfig</span><span class="o">.</span><span class="nx">getProperty</span><span class="o">(</span><span class="s2">&quot;emphasis&quot;</span><span class="o">))</span> <span class="o">{</span>

            <span class="nx">oConfig</span><span class="o">.</span><span class="nx">setProperty</span><span class="o">(</span><span class="s2">&quot;emphasis&quot;</span><span class="o">,</span> <span class="kc">false</span><span class="o">);</span>

        <span class="o">}</span>

        <span class="k">if</span><span class="o">(</span><span class="nx">oAnchor</span><span class="o">)</span> <span class="o">{</span>

            <span class="k">if</span><span class="o">(</span><span class="nx">bStrongEmphasis</span><span class="o">)</span> <span class="o">{</span>

                <span class="nx">oStrong</span> <span class="o">=</span> <span class="nb">document</span><span class="o">.</span><span class="nx">createElement</span><span class="o">(</span><span class="s2">&quot;strong&quot;</span><span class="o">);</span>
                <span class="nx">oStrong</span><span class="o">.</span><span class="nx">appendChild</span><span class="o">(</span><span class="nx">oText</span><span class="o">);</span>

                <span class="nx">oAnchor</span><span class="o">.</span><span class="nx">appendChild</span><span class="o">(</span><span class="nx">oStrong</span><span class="o">);</span>

            <span class="o">}</span>
            <span class="k">else</span> <span class="o">{</span>

                <span class="nx">oStrong</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">_getFirstElement</span><span class="o">(</span><span class="nx">oAnchor</span><span class="o">,</span> <span class="s2">&quot;STRONG&quot;</span><span class="o">);</span>

                <span class="k">if</span><span class="o">(</span><span class="nx">oStrong</span><span class="o">)</span> <span class="o">{</span>

                    <span class="nx">oAnchor</span><span class="o">.</span><span class="nx">removeChild</span><span class="o">(</span><span class="nx">oStrong</span><span class="o">);</span>
                    <span class="nx">oAnchor</span><span class="o">.</span><span class="nx">appendChild</span><span class="o">(</span><span class="nx">oText</span><span class="o">);</span>

                <span class="o">}</span>

            <span class="o">}</span>

        <span class="o">}</span>

    <span class="o">},</span>


    <span class="c">/**</span>
<span class="c">    * @method configChecked</span>
<span class="c">    * @description Event handler for when the &quot;checked&quot; configuration property </span>
<span class="c">    * of the menu item changes. </span>
<span class="c">    * @param {String} p_sType String representing the name of the event that </span>
<span class="c">    * was fired.</span>
<span class="c">    * @param {Array} p_aArgs Array of arguments sent when the event was fired.</span>
<span class="c">    * @param {YAHOO.widget.MenuItem} p_oItem Object representing the menu item</span>
<span class="c">    * that fired the event.</span>
<span class="c">    */</span>    
    <span class="nx">configChecked</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">p_sType</span><span class="o">,</span> <span class="nx">p_aArgs</span><span class="o">,</span> <span class="nx">p_oItem</span><span class="o">)</span> <span class="o">{</span>
    
        <span class="k">var</span> <span class="nx">bChecked</span> <span class="o">=</span> <span class="nx">p_aArgs</span><span class="o">[</span><span class="m">0</span><span class="o">],</span>
            <span class="nx">oEl</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">element</span><span class="o">,</span>
            <span class="nx">oConfig</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">cfg</span><span class="o">,</span>
            <span class="nx">oImg</span><span class="o">;</span>
        

        <span class="k">if</span><span class="o">(</span><span class="nx">bChecked</span><span class="o">)</span> <span class="o">{</span>

            <span class="k">this</span><span class="o">.</span><span class="nx">_preloadImage</span><span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">CHECKED_IMAGE_PATH</span><span class="o">);</span>
            <span class="k">this</span><span class="o">.</span><span class="nx">_preloadImage</span><span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">SELECTED_CHECKED_IMAGE_PATH</span><span class="o">);</span>
            <span class="k">this</span><span class="o">.</span><span class="nx">_preloadImage</span><span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">DISABLED_CHECKED_IMAGE_PATH</span><span class="o">);</span>


            <span class="nx">oImg</span> <span class="o">=</span> <span class="nb">document</span><span class="o">.</span><span class="nx">createElement</span><span class="o">(</span><span class="s2">&quot;img&quot;</span><span class="o">);</span>
            <span class="nx">oImg</span><span class="o">.</span><span class="nx">src</span> <span class="o">=</span> <span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">imageRoot</span> <span class="o">+</span> <span class="k">this</span><span class="o">.</span><span class="nx">CHECKED_IMAGE_PATH</span><span class="o">);</span>
            <span class="nx">oImg</span><span class="o">.</span><span class="nx">alt</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">CHECKED_IMAGE_ALT_TEXT</span><span class="o">;</span>

            <span class="k">var</span> <span class="nx">oSubmenu</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">cfg</span><span class="o">.</span><span class="nx">getProperty</span><span class="o">(</span><span class="s2">&quot;submenu&quot;</span><span class="o">);</span>

            <span class="k">if</span><span class="o">(</span><span class="nx">oSubmenu</span><span class="o">)</span> <span class="o">{</span>

                <span class="nx">oEl</span><span class="o">.</span><span class="nx">insertBefore</span><span class="o">(</span><span class="nx">oImg</span><span class="o">,</span> <span class="nx">oSubmenu</span><span class="o">.</span><span class="nx">element</span><span class="o">);</span>

            <span class="o">}</span>
            <span class="k">else</span> <span class="o">{</span>

                <span class="nx">oEl</span><span class="o">.</span><span class="nx">appendChild</span><span class="o">(</span><span class="nx">oImg</span><span class="o">);</span>            

            <span class="o">}</span>


            <span class="nx">Dom</span><span class="o">.</span><span class="nx">addClass</span><span class="o">([</span><span class="nx">oEl</span><span class="o">,</span> <span class="nx">oImg</span><span class="o">],</span> <span class="s2">&quot;checked&quot;</span><span class="o">);</span>

            <span class="k">this</span><span class="o">.</span><span class="nx">_checkImage</span> <span class="o">=</span> <span class="nx">oImg</span><span class="o">;</span>

            <span class="k">if</span><span class="o">(</span><span class="nx">oConfig</span><span class="o">.</span><span class="nx">getProperty</span><span class="o">(</span><span class="s2">&quot;disabled&quot;</span><span class="o">))</span> <span class="o">{</span>

                <span class="nx">oConfig</span><span class="o">.</span><span class="nx">refireEvent</span><span class="o">(</span><span class="s2">&quot;disabled&quot;</span><span class="o">);</span>

            <span class="o">}</span>

            <span class="k">if</span><span class="o">(</span><span class="nx">oConfig</span><span class="o">.</span><span class="nx">getProperty</span><span class="o">(</span><span class="s2">&quot;selected&quot;</span><span class="o">))</span> <span class="o">{</span>

                <span class="nx">oConfig</span><span class="o">.</span><span class="nx">refireEvent</span><span class="o">(</span><span class="s2">&quot;selected&quot;</span><span class="o">);</span>

            <span class="o">}</span>
        
        <span class="o">}</span>
        <span class="k">else</span> <span class="o">{</span>

            <span class="nx">oImg</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">_checkImage</span><span class="o">;</span>

            <span class="nx">Dom</span><span class="o">.</span><span class="nx">removeClass</span><span class="o">([</span><span class="nx">oEl</span><span class="o">,</span> <span class="nx">oImg</span><span class="o">],</span> <span class="s2">&quot;checked&quot;</span><span class="o">);</span>

            <span class="k">if</span><span class="o">(</span><span class="nx">oImg</span><span class="o">)</span> <span class="o">{</span>

                <span class="nx">oEl</span><span class="o">.</span><span class="nx">removeChild</span><span class="o">(</span><span class="nx">oImg</span><span class="o">);</span>

            <span class="o">}</span>

            <span class="k">this</span><span class="o">.</span><span class="nx">_checkImage</span> <span class="o">=</span> <span class="kc">null</span><span class="o">;</span>
        
        <span class="o">}</span>

    <span class="o">},</span>



    <span class="c">/**</span>
<span class="c">    * @method configDisabled</span>
<span class="c">    * @description Event handler for when the &quot;disabled&quot; configuration property </span>
<span class="c">    * of the menu item changes. </span>
<span class="c">    * @param {String} p_sType String representing the name of the event that </span>
<span class="c">    * was fired.</span>
<span class="c">    * @param {Array} p_aArgs Array of arguments sent when the event was fired.</span>
<span class="c">    * @param {YAHOO.widget.MenuItem} p_oItem Object representing the menu item</span>
<span class="c">    * that fired the event.</span>
<span class="c">    */</span>    
    <span class="nx">configDisabled</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">p_sType</span><span class="o">,</span> <span class="nx">p_aArgs</span><span class="o">,</span> <span class="nx">p_oItem</span><span class="o">)</span> <span class="o">{</span>

        <span class="k">var</span> <span class="nx">bDisabled</span> <span class="o">=</span> <span class="nx">p_aArgs</span><span class="o">[</span><span class="m">0</span><span class="o">],</span>
            <span class="nx">oAnchor</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">_oAnchor</span><span class="o">,</span>
            <span class="nx">aNodes</span> <span class="o">=</span> <span class="o">[</span><span class="k">this</span><span class="o">.</span><span class="nx">element</span><span class="o">,</span> <span class="nx">oAnchor</span><span class="o">],</span>
            <span class="nx">oEM</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">_oHelpTextEM</span><span class="o">,</span>
            <span class="nx">oConfig</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">cfg</span><span class="o">,</span>
            <span class="nx">oImg</span><span class="o">,</span>
            <span class="nx">sImgSrc</span><span class="o">,</span>
            <span class="nx">sImgAlt</span><span class="o">;</span>


        <span class="k">if</span><span class="o">(</span><span class="nx">oEM</span><span class="o">)</span> <span class="o">{</span>

            <span class="nx">aNodes</span><span class="o">[</span><span class="m">2</span><span class="o">]</span> <span class="o">=</span> <span class="nx">oEM</span><span class="o">;</span>

        <span class="o">}</span>


        <span class="k">if</span><span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">cfg</span><span class="o">.</span><span class="nx">getProperty</span><span class="o">(</span><span class="s2">&quot;checked&quot;</span><span class="o">))</span> <span class="o">{</span>
    
            <span class="nx">sImgAlt</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">CHECKED_IMAGE_ALT_TEXT</span><span class="o">;</span>
            <span class="nx">sImgSrc</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">CHECKED_IMAGE_PATH</span><span class="o">;</span>
            <span class="nx">oImg</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">_checkImage</span><span class="o">;</span>
            
            <span class="k">if</span><span class="o">(</span><span class="nx">bDisabled</span><span class="o">)</span> <span class="o">{</span>
    
                <span class="nx">sImgAlt</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">DISABLED_CHECKED_IMAGE_ALT_TEXT</span><span class="o">;</span>
                <span class="nx">sImgSrc</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">DISABLED_CHECKED_IMAGE_PATH</span><span class="o">;</span>
            
            <span class="o">}</span>

            <span class="nx">oImg</span><span class="o">.</span><span class="nx">src</span> <span class="o">=</span> <span class="nb">document</span><span class="o">.</span><span class="nx">images</span><span class="o">[(</span><span class="k">this</span><span class="o">.</span><span class="nx">imageRoot</span> <span class="o">+</span> <span class="nx">sImgSrc</span><span class="o">)].</span><span class="nx">src</span><span class="o">;</span>
            <span class="nx">oImg</span><span class="o">.</span><span class="nx">alt</span> <span class="o">=</span> <span class="nx">sImgAlt</span><span class="o">;</span>
            
        <span class="o">}</span>    


        <span class="nx">oImg</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">submenuIndicator</span><span class="o">;</span>

        <span class="k">if</span><span class="o">(</span><span class="nx">bDisabled</span><span class="o">)</span> <span class="o">{</span>

            <span class="k">if</span><span class="o">(</span><span class="nx">oConfig</span><span class="o">.</span><span class="nx">getProperty</span><span class="o">(</span><span class="s2">&quot;selected&quot;</span><span class="o">))</span> <span class="o">{</span>

                <span class="nx">oConfig</span><span class="o">.</span><span class="nx">setProperty</span><span class="o">(</span><span class="s2">&quot;selected&quot;</span><span class="o">,</span> <span class="kc">false</span><span class="o">);</span>

            <span class="o">}</span>

            <span class="nx">oAnchor</span><span class="o">.</span><span class="nx">removeAttribute</span><span class="o">(</span><span class="s2">&quot;href&quot;</span><span class="o">);</span>

            <span class="nx">Dom</span><span class="o">.</span><span class="nx">addClass</span><span class="o">(</span><span class="nx">aNodes</span><span class="o">,</span> <span class="s2">&quot;disabled&quot;</span><span class="o">);</span>

            <span class="nx">sImgSrc</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">DISABLED_SUBMENU_INDICATOR_IMAGE_PATH</span><span class="o">;</span>
            <span class="nx">sImgAlt</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">DISABLED_SUBMENU_INDICATOR_ALT_TEXT</span><span class="o">;</span>

        <span class="o">}</span>
        <span class="k">else</span> <span class="o">{</span>

            <span class="nx">oAnchor</span><span class="o">.</span><span class="nx">setAttribute</span><span class="o">(</span><span class="s2">&quot;href&quot;</span><span class="o">,</span> <span class="nx">oConfig</span><span class="o">.</span><span class="nx">getProperty</span><span class="o">(</span><span class="s2">&quot;url&quot;</span><span class="o">));</span>

            <span class="nx">Dom</span><span class="o">.</span><span class="nx">removeClass</span><span class="o">(</span><span class="nx">aNodes</span><span class="o">,</span> <span class="s2">&quot;disabled&quot;</span><span class="o">);</span>

            <span class="nx">sImgSrc</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">SUBMENU_INDICATOR_IMAGE_PATH</span><span class="o">;</span>
            <span class="nx">sImgAlt</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">COLLAPSED_SUBMENU_INDICATOR_ALT_TEXT</span><span class="o">;</span>

        <span class="o">}</span>


        <span class="k">if</span><span class="o">(</span><span class="nx">oImg</span><span class="o">)</span> <span class="o">{</span>

            <span class="nx">oImg</span><span class="o">.</span><span class="nx">src</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">imageRoot</span> <span class="o">+</span> <span class="nx">sImgSrc</span><span class="o">;</span>
            <span class="nx">oImg</span><span class="o">.</span><span class="nx">alt</span> <span class="o">=</span> <span class="nx">sImgAlt</span><span class="o">;</span>

        <span class="o">}</span>

    <span class="o">},</span>


    <span class="c">/**</span>
<span class="c">    * @method configSelected</span>
<span class="c">    * @description Event handler for when the &quot;selected&quot; configuration property </span>
<span class="c">    * of the menu item changes. </span>
<span class="c">    * @param {String} p_sType String representing the name of the event that </span>
<span class="c">    * was fired.</span>
<span class="c">    * @param {Array} p_aArgs Array of arguments sent when the event was fired.</span>
<span class="c">    * @param {YAHOO.widget.MenuItem} p_oItem Object representing the menu item</span>
<span class="c">    * that fired the event.</span>
<span class="c">    */</span>    
    <span class="nx">configSelected</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">p_sType</span><span class="o">,</span> <span class="nx">p_aArgs</span><span class="o">,</span> <span class="nx">p_oItem</span><span class="o">)</span> <span class="o">{</span>

        <span class="k">if</span><span class="o">(!</span><span class="k">this</span><span class="o">.</span><span class="nx">cfg</span><span class="o">.</span><span class="nx">getProperty</span><span class="o">(</span><span class="s2">&quot;disabled&quot;</span><span class="o">))</span> <span class="o">{</span>

            <span class="k">var</span> <span class="nx">bSelected</span> <span class="o">=</span> <span class="nx">p_aArgs</span><span class="o">[</span><span class="m">0</span><span class="o">],</span>
                <span class="nx">oEM</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">_oHelpTextEM</span><span class="o">,</span>
                <span class="nx">aNodes</span> <span class="o">=</span> <span class="o">[</span><span class="k">this</span><span class="o">.</span><span class="nx">element</span><span class="o">,</span> <span class="k">this</span><span class="o">.</span><span class="nx">_oAnchor</span><span class="o">],</span>
                <span class="nx">oImg</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">submenuIndicator</span><span class="o">,</span>
                <span class="nx">sImgSrc</span><span class="o">;</span>


            <span class="k">if</span><span class="o">(</span><span class="nx">oEM</span><span class="o">)</span> <span class="o">{</span>
    
                <span class="nx">aNodes</span><span class="o">[</span><span class="nx">aNodes</span><span class="o">.</span><span class="nx">length</span><span class="o">]</span> <span class="o">=</span> <span class="nx">oEM</span><span class="o">;</span>  
    
            <span class="o">}</span>
            
            <span class="k">if</span><span class="o">(</span><span class="nx">oImg</span><span class="o">)</span> <span class="o">{</span>

                <span class="nx">aNodes</span><span class="o">[</span><span class="nx">aNodes</span><span class="o">.</span><span class="nx">length</span><span class="o">]</span> <span class="o">=</span> <span class="nx">oImg</span><span class="o">;</span>  
            
            <span class="o">}</span>
    

            <span class="k">if</span><span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">cfg</span><span class="o">.</span><span class="nx">getProperty</span><span class="o">(</span><span class="s2">&quot;checked&quot;</span><span class="o">))</span> <span class="o">{</span>
    
                <span class="nx">sImgSrc</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">imageRoot</span> <span class="o">+</span> <span class="o">(</span><span class="nx">bSelected</span> <span class="o">?</span> 
                    <span class="k">this</span><span class="o">.</span><span class="nx">SELECTED_CHECKED_IMAGE_PATH</span> <span class="o">:</span> <span class="k">this</span><span class="o">.</span><span class="nx">CHECKED_IMAGE_PATH</span><span class="o">);</span>
    
                <span class="k">this</span><span class="o">.</span><span class="nx">_checkImage</span><span class="o">.</span><span class="nx">src</span> <span class="o">=</span> <span class="nb">document</span><span class="o">.</span><span class="nx">images</span><span class="o">[</span><span class="nx">sImgSrc</span><span class="o">].</span><span class="nx">src</span><span class="o">;</span>
                
            <span class="o">}</span>


            <span class="k">if</span><span class="o">(</span><span class="nx">bSelected</span><span class="o">)</span> <span class="o">{</span>
    
                <span class="nx">Dom</span><span class="o">.</span><span class="nx">addClass</span><span class="o">(</span><span class="nx">aNodes</span><span class="o">,</span> <span class="s2">&quot;selected&quot;</span><span class="o">);</span>
                <span class="nx">sImgSrc</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">SELECTED_SUBMENU_INDICATOR_IMAGE_PATH</span><span class="o">;</span>
    
            <span class="o">}</span>
            <span class="k">else</span> <span class="o">{</span>
    
                <span class="nx">Dom</span><span class="o">.</span><span class="nx">removeClass</span><span class="o">(</span><span class="nx">aNodes</span><span class="o">,</span> <span class="s2">&quot;selected&quot;</span><span class="o">);</span>
                <span class="nx">sImgSrc</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">SUBMENU_INDICATOR_IMAGE_PATH</span><span class="o">;</span>
    
            <span class="o">}</span>
    
            <span class="k">if</span><span class="o">(</span><span class="nx">oImg</span><span class="o">)</span> <span class="o">{</span>
    
                <span class="nx">oImg</span><span class="o">.</span><span class="nx">src</span> <span class="o">=</span> <span class="nb">document</span><span class="o">.</span><span class="nx">images</span><span class="o">[(</span><span class="k">this</span><span class="o">.</span><span class="nx">imageRoot</span> <span class="o">+</span> <span class="nx">sImgSrc</span><span class="o">)].</span><span class="nx">src</span><span class="o">;</span>

            <span class="o">}</span>

        <span class="o">}</span>

    <span class="o">},</span>


    <span class="c">/**</span>
<span class="c">    * @method configSubmenu</span>
<span class="c">    * @description Event handler for when the &quot;submenu&quot; configuration property </span>
<span class="c">    * of the menu item changes. </span>
<span class="c">    * @param {String} p_sType String representing the name of the event that </span>
<span class="c">    * was fired.</span>
<span class="c">    * @param {Array} p_aArgs Array of arguments sent when the event was fired.</span>
<span class="c">    * @param {YAHOO.widget.MenuItem} p_oItem Object representing the menu item</span>
<span class="c">    * that fired the event.</span>
<span class="c">    */</span>
    <span class="nx">configSubmenu</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">p_sType</span><span class="o">,</span> <span class="nx">p_aArgs</span><span class="o">,</span> <span class="nx">p_oItem</span><span class="o">)</span> <span class="o">{</span>

        <span class="k">var</span> <span class="nx">oEl</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">element</span><span class="o">,</span>
            <span class="nx">oSubmenu</span> <span class="o">=</span> <span class="nx">p_aArgs</span><span class="o">[</span><span class="m">0</span><span class="o">],</span>
            <span class="nx">oImg</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">submenuIndicator</span><span class="o">,</span>
            <span class="nx">oConfig</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">cfg</span><span class="o">,</span>
            <span class="nx">aNodes</span> <span class="o">=</span> <span class="o">[</span><span class="k">this</span><span class="o">.</span><span class="nx">element</span><span class="o">,</span> <span class="k">this</span><span class="o">.</span><span class="nx">_oAnchor</span><span class="o">],</span>
            <span class="nx">oMenu</span><span class="o">,</span>
            <span class="nx">bLazyLoad</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">parent</span> <span class="o">&amp;&amp;</span> <span class="k">this</span><span class="o">.</span><span class="nx">parent</span><span class="o">.</span><span class="nx">lazyLoad</span><span class="o">;</span>


        <span class="k">if</span><span class="o">(</span><span class="nx">oSubmenu</span><span class="o">)</span> <span class="o">{</span>

            <span class="k">if</span><span class="o">(</span><span class="nx">oSubmenu</span> <span class="k">instanceof</span> <span class="nx">Menu</span><span class="o">)</span> <span class="o">{</span>

                <span class="nx">oMenu</span> <span class="o">=</span> <span class="nx">oSubmenu</span><span class="o">;</span>
                <span class="nx">oMenu</span><span class="o">.</span><span class="nx">parent</span> <span class="o">=</span> <span class="k">this</span><span class="o">;</span>
                <span class="nx">oMenu</span><span class="o">.</span><span class="nx">lazyLoad</span> <span class="o">=</span> <span class="nx">bLazyLoad</span><span class="o">;</span>

            <span class="o">}</span>
            <span class="k">else</span> <span class="k">if</span><span class="o">(</span>
                <span class="k">typeof</span> <span class="nx">oSubmenu</span> <span class="o">==</span> <span class="s2">&quot;object&quot;</span> <span class="o">&amp;&amp;</span> 
                <span class="nx">oSubmenu</span><span class="o">.</span><span class="nx">id</span> <span class="o">&amp;&amp;</span> 
                <span class="o">!</span><span class="nx">oSubmenu</span><span class="o">.</span><span class="nx">nodeType</span>
            <span class="o">)</span> <span class="o">{</span>

                <span class="k">var</span> <span class="nx">sSubmenuId</span> <span class="o">=</span> <span class="nx">oSubmenu</span><span class="o">.</span><span class="nx">id</span><span class="o">,</span>
                    <span class="nx">oSubmenuConfig</span> <span class="o">=</span> <span class="nx">oSubmenu</span><span class="o">;</span>

                <span class="nx">oSubmenuConfig</span><span class="o">.</span><span class="nx">lazyload</span> <span class="o">=</span> <span class="nx">bLazyLoad</span><span class="o">;</span>
                <span class="nx">oSubmenuConfig</span><span class="o">.</span><span class="nx">parent</span> <span class="o">=</span> <span class="k">this</span><span class="o">;</span>

                <span class="nx">oMenu</span> <span class="o">=</span> <span class="k">new</span> <span class="k">this</span><span class="o">.</span><span class="nx">SUBMENU_TYPE</span><span class="o">(</span><span class="nx">sSubmenuId</span><span class="o">,</span> <span class="nx">oSubmenuConfig</span><span class="o">);</span>


                <span class="c">// Set the value of the property to the Menu instance</span>
<span class="c"></span>                
                <span class="k">this</span><span class="o">.</span><span class="nx">cfg</span><span class="o">.</span><span class="nx">setProperty</span><span class="o">(</span><span class="s2">&quot;submenu&quot;</span><span class="o">,</span> <span class="nx">oMenu</span><span class="o">,</span> <span class="kc">true</span><span class="o">);</span>

            <span class="o">}</span>
            <span class="k">else</span> <span class="o">{</span>

                <span class="nx">oMenu</span> <span class="o">=</span> <span class="k">new</span> <span class="k">this</span><span class="o">.</span><span class="nx">SUBMENU_TYPE</span><span class="o">(</span>
                                <span class="nx">oSubmenu</span><span class="o">,</span>
                                <span class="o">{</span> <span class="nx">lazyload</span><span class="o">:</span> <span class="nx">bLazyLoad</span><span class="o">,</span> <span class="nx">parent</span><span class="o">:</span> <span class="k">this</span> <span class="o">}</span>                
                            <span class="o">);</span>


                <span class="c">// Set the value of the property to the Menu instance</span>
<span class="c"></span>                
                <span class="k">this</span><span class="o">.</span><span class="nx">cfg</span><span class="o">.</span><span class="nx">setProperty</span><span class="o">(</span><span class="s2">&quot;submenu&quot;</span><span class="o">,</span> <span class="nx">oMenu</span><span class="o">,</span> <span class="kc">true</span><span class="o">);</span>

            <span class="o">}</span>


            <span class="k">if</span><span class="o">(</span><span class="nx">oMenu</span><span class="o">)</span> <span class="o">{</span>

                <span class="k">this</span><span class="o">.</span><span class="nx">_oSubmenu</span> <span class="o">=</span> <span class="nx">oMenu</span><span class="o">;</span>


                <span class="k">if</span><span class="o">(!</span><span class="nx">oImg</span><span class="o">)</span> <span class="o">{</span> 

                    <span class="k">this</span><span class="o">.</span><span class="nx">_preloadImage</span><span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">SUBMENU_INDICATOR_IMAGE_PATH</span><span class="o">);</span>
                    <span class="k">this</span><span class="o">.</span><span class="nx">_preloadImage</span><span class="o">(</span>
                            <span class="k">this</span><span class="o">.</span><span class="nx">SELECTED_SUBMENU_INDICATOR_IMAGE_PATH</span>
                        <span class="o">);</span>

                    <span class="k">this</span><span class="o">.</span><span class="nx">_preloadImage</span><span class="o">(</span>
                            <span class="k">this</span><span class="o">.</span><span class="nx">DISABLED_SUBMENU_INDICATOR_IMAGE_PATH</span>
                        <span class="o">);</span>

                    <span class="nx">oImg</span> <span class="o">=</span> <span class="nb">document</span><span class="o">.</span><span class="nx">createElement</span><span class="o">(</span><span class="s2">&quot;img&quot;</span><span class="o">);</span>

                    <span class="nx">oImg</span><span class="o">.</span><span class="nx">src</span> <span class="o">=</span> 
                        <span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">imageRoot</span> <span class="o">+</span> <span class="k">this</span><span class="o">.</span><span class="nx">SUBMENU_INDICATOR_IMAGE_PATH</span><span class="o">);</span>

                    <span class="nx">oImg</span><span class="o">.</span><span class="nx">alt</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">COLLAPSED_SUBMENU_INDICATOR_ALT_TEXT</span><span class="o">;</span>

                    <span class="nx">oEl</span><span class="o">.</span><span class="nx">appendChild</span><span class="o">(</span><span class="nx">oImg</span><span class="o">);</span>

                    <span class="k">this</span><span class="o">.</span><span class="nx">submenuIndicator</span> <span class="o">=</span> <span class="nx">oImg</span><span class="o">;</span>

                    <span class="nx">Dom</span><span class="o">.</span><span class="nx">addClass</span><span class="o">(</span><span class="nx">aNodes</span><span class="o">,</span> <span class="s2">&quot;hassubmenu&quot;</span><span class="o">);</span>


                    <span class="k">if</span><span class="o">(</span><span class="nx">oConfig</span><span class="o">.</span><span class="nx">getProperty</span><span class="o">(</span><span class="s2">&quot;disabled&quot;</span><span class="o">))</span> <span class="o">{</span>
    
                        <span class="nx">oConfig</span><span class="o">.</span><span class="nx">refireEvent</span><span class="o">(</span><span class="s2">&quot;disabled&quot;</span><span class="o">);</span>

                    <span class="o">}</span>

                    <span class="k">if</span><span class="o">(</span><span class="nx">oConfig</span><span class="o">.</span><span class="nx">getProperty</span><span class="o">(</span><span class="s2">&quot;selected&quot;</span><span class="o">))</span> <span class="o">{</span>
    
                        <span class="nx">oConfig</span><span class="o">.</span><span class="nx">refireEvent</span><span class="o">(</span><span class="s2">&quot;selected&quot;</span><span class="o">);</span>
    
                    <span class="o">}</span>                
    
                <span class="o">}</span>
            
            <span class="o">}</span>

        <span class="o">}</span>
        <span class="k">else</span> <span class="o">{</span>

            <span class="nx">Dom</span><span class="o">.</span><span class="nx">removeClass</span><span class="o">(</span><span class="nx">aNodes</span><span class="o">,</span> <span class="s2">&quot;hassubmenu&quot;</span><span class="o">);</span>

            <span class="k">if</span><span class="o">(</span><span class="nx">oImg</span><span class="o">)</span> <span class="o">{</span>

                <span class="nx">oEl</span><span class="o">.</span><span class="nx">removeChild</span><span class="o">(</span><span class="nx">oImg</span><span class="o">);</span>

            <span class="o">}</span>

            <span class="k">if</span><span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">_oSubmenu</span><span class="o">)</span> <span class="o">{</span>

                <span class="k">this</span><span class="o">.</span><span class="nx">_oSubmenu</span><span class="o">.</span><span class="nx">destroy</span><span class="o">();</span>

            <span class="o">}</span>

        <span class="o">}</span>

    <span class="o">},</span>


    <span class="c">// Public methods</span>
<span class="c"></span>
	<span class="c">/**</span>
<span class="c">    * @method initDefaultConfig</span>
<span class="c">	* @description Initializes an item&#39;s configurable properties.</span>
<span class="c">	*/</span>
	<span class="nx">initDefaultConfig</span> <span class="o">:</span> <span class="k">function</span><span class="o">()</span> <span class="o">{</span>

        <span class="k">var</span> <span class="nx">oConfig</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">cfg</span><span class="o">,</span>
            <span class="nx">CheckBoolean</span> <span class="o">=</span> <span class="nx">oConfig</span><span class="o">.</span><span class="nx">checkBoolean</span><span class="o">;</span>


        <span class="c">// Define the config properties</span>
<span class="c"></span>
        <span class="c">/**</span>
<span class="c">        * @config text</span>
<span class="c">        * @description String specifying the text label for the menu item.  </span>
<span class="c">        * When building a menu from existing HTML the value of this property</span>
<span class="c">        * will be interpreted from the menu&#39;s markup.</span>
<span class="c">        * @default &quot;&quot;</span>
<span class="c">        * @type String</span>
<span class="c">        */</span>
        <span class="nx">oConfig</span><span class="o">.</span><span class="nx">addProperty</span><span class="o">(</span>
            <span class="s2">&quot;text&quot;</span><span class="o">,</span> 
            <span class="o">{</span> 
                <span class="nx">value</span><span class="o">:</span> <span class="s2">&quot;&quot;</span><span class="o">,</span> 
                <span class="nx">handler</span><span class="o">:</span> <span class="k">this</span><span class="o">.</span><span class="nx">configText</span><span class="o">,</span> 
                <span class="nx">validator</span><span class="o">:</span> <span class="k">this</span><span class="o">.</span><span class="nx">_checkString</span><span class="o">,</span> 
                <span class="nx">suppressEvent</span><span class="o">:</span> <span class="kc">true</span> 
            <span class="o">}</span>
        <span class="o">);</span>
        

        <span class="c">/**</span>
<span class="c">        * @config helptext</span>
<span class="c">        * @description String specifying additional instructional text to </span>
<span class="c">        * accompany the text for the nenu item.</span>
<span class="c">        * @default null</span>
<span class="c">        * @type String|&lt;a href=&quot;http://www.w3.org/TR/</span>
<span class="c">        * 2000/WD-DOM-Level-1-20000929/level-one-html.html#ID-58190037&quot;&gt;</span>
<span class="c">        * HTMLElement&lt;/a&gt;</span>
<span class="c">        */</span>
        <span class="nx">oConfig</span><span class="o">.</span><span class="nx">addProperty</span><span class="o">(</span><span class="s2">&quot;helptext&quot;</span><span class="o">,</span> <span class="o">{</span> <span class="nx">handler</span><span class="o">:</span> <span class="k">this</span><span class="o">.</span><span class="nx">configHelpText</span> <span class="o">});</span>


        <span class="c">/**</span>
<span class="c">        * @config url</span>
<span class="c">        * @description String specifying the URL for the menu item&#39;s anchor&#39;s </span>
<span class="c">        * &quot;href&quot; attribute.  When building a menu from existing HTML the value </span>
<span class="c">        * of this property will be interpreted from the menu&#39;s markup.</span>
<span class="c">        * @default &quot;#&quot;</span>
<span class="c">        * @type String</span>
<span class="c">        */</span>        
        <span class="nx">oConfig</span><span class="o">.</span><span class="nx">addProperty</span><span class="o">(</span>
            <span class="s2">&quot;url&quot;</span><span class="o">,</span> 
            <span class="o">{</span> <span class="nx">value</span><span class="o">:</span> <span class="s2">&quot;#&quot;</span><span class="o">,</span> <span class="nx">handler</span><span class="o">:</span> <span class="k">this</span><span class="o">.</span><span class="nx">configURL</span><span class="o">,</span> <span class="nx">suppressEvent</span><span class="o">:</span> <span class="kc">true</span> <span class="o">}</span>
        <span class="o">);</span>


        <span class="c">/**</span>
<span class="c">        * @config target</span>
<span class="c">        * @description String specifying the value for the &quot;target&quot; attribute </span>
<span class="c">        * of the menu item&#39;s anchor element. &lt;strong&gt;Specifying a target will </span>
<span class="c">        * require the user to click directly on the menu item&#39;s anchor node in</span>
<span class="c">        * order to cause the browser to navigate to the specified URL.&lt;/strong&gt; </span>
<span class="c">        * When building a menu from existing HTML the value of this property </span>
<span class="c">        * will be interpreted from the menu&#39;s markup.</span>
<span class="c">        * @default null</span>
<span class="c">        * @type String</span>
<span class="c">        */</span>        
        <span class="nx">oConfig</span><span class="o">.</span><span class="nx">addProperty</span><span class="o">(</span>
            <span class="s2">&quot;target&quot;</span><span class="o">,</span> 
            <span class="o">{</span> <span class="nx">handler</span><span class="o">:</span> <span class="k">this</span><span class="o">.</span><span class="nx">configTarget</span><span class="o">,</span> <span class="nx">suppressEvent</span><span class="o">:</span> <span class="kc">true</span> <span class="o">}</span>
        <span class="o">);</span>


        <span class="c">/**</span>
<span class="c">        * @config emphasis</span>
<span class="c">        * @description Boolean indicating if the text of the menu item will be </span>
<span class="c">        * rendered with emphasis.  When building a menu from existing HTML the </span>
<span class="c">        * value of this property will be interpreted from the menu&#39;s markup.</span>
<span class="c">        * @default false</span>
<span class="c">        * @type Boolean</span>
<span class="c">        */</span>
        <span class="nx">oConfig</span><span class="o">.</span><span class="nx">addProperty</span><span class="o">(</span>
            <span class="s2">&quot;emphasis&quot;</span><span class="o">,</span> 
            <span class="o">{</span> 
                <span class="nx">value</span><span class="o">:</span> <span class="kc">false</span><span class="o">,</span> 
                <span class="nx">handler</span><span class="o">:</span> <span class="k">this</span><span class="o">.</span><span class="nx">configEmphasis</span><span class="o">,</span> 
                <span class="nx">validator</span><span class="o">:</span> <span class="nx">CheckBoolean</span><span class="o">,</span> 
                <span class="nx">suppressEvent</span><span class="o">:</span> <span class="kc">true</span> 
            <span class="o">}</span>
        <span class="o">);</span>


        <span class="c">/**</span>
<span class="c">        * @config strongemphasis</span>
<span class="c">        * @description Boolean indicating if the text of the menu item will be </span>
<span class="c">        * rendered with strong emphasis.  When building a menu from existing </span>
<span class="c">        * HTML the value of this property will be interpreted from the</span>
<span class="c">        * menu&#39;s markup.</span>
<span class="c">        * @default false</span>
<span class="c">        * @type Boolean</span>
<span class="c">        */</span>
        <span class="nx">oConfig</span><span class="o">.</span><span class="nx">addProperty</span><span class="o">(</span>
            <span class="s2">&quot;strongemphasis&quot;</span><span class="o">,</span>
            <span class="o">{</span>
                <span class="nx">value</span><span class="o">:</span> <span class="kc">false</span><span class="o">,</span>
                <span class="nx">handler</span><span class="o">:</span> <span class="k">this</span><span class="o">.</span><span class="nx">configStrongEmphasis</span><span class="o">,</span>
                <span class="nx">validator</span><span class="o">:</span> <span class="nx">CheckBoolean</span><span class="o">,</span>
                <span class="nx">suppressEvent</span><span class="o">:</span> <span class="kc">true</span>
            <span class="o">}</span>
        <span class="o">);</span>


        <span class="c">/**</span>
<span class="c">        * @config checked</span>
<span class="c">        * @description Boolean indicating if the menu item should be rendered </span>
<span class="c">        * with a checkmark.</span>
<span class="c">        * @default false</span>
<span class="c">        * @type Boolean</span>
<span class="c">        */</span>
        <span class="nx">oConfig</span><span class="o">.</span><span class="nx">addProperty</span><span class="o">(</span>
            <span class="s2">&quot;checked&quot;</span><span class="o">,</span> 
            <span class="o">{</span>
                <span class="nx">value</span><span class="o">:</span> <span class="kc">false</span><span class="o">,</span> 
                <span class="nx">handler</span><span class="o">:</span> <span class="k">this</span><span class="o">.</span><span class="nx">configChecked</span><span class="o">,</span> 
                <span class="nx">validator</span><span class="o">:</span> <span class="k">this</span><span class="o">.</span><span class="nx">cfg</span><span class="o">.</span><span class="nx">checkBoolean</span><span class="o">,</span> 
                <span class="nx">suppressEvent</span><span class="o">:</span> <span class="kc">true</span><span class="o">,</span>
                <span class="nx">supercedes</span><span class="o">:[</span><span class="s2">&quot;disabled&quot;</span><span class="o">]</span>
            <span class="o">}</span> 
        <span class="o">);</span>


        <span class="c">/**</span>
<span class="c">        * @config disabled</span>
<span class="c">        * @description Boolean indicating if the menu item should be disabled.  </span>
<span class="c">        * (Disabled menu items are  dimmed and will not respond to user input </span>
<span class="c">        * or fire events.)</span>
<span class="c">        * @default false</span>
<span class="c">        * @type Boolean</span>
<span class="c">        */</span>
        <span class="nx">oConfig</span><span class="o">.</span><span class="nx">addProperty</span><span class="o">(</span>
            <span class="s2">&quot;disabled&quot;</span><span class="o">,</span>
            <span class="o">{</span>
                <span class="nx">value</span><span class="o">:</span> <span class="kc">false</span><span class="o">,</span>
                <span class="nx">handler</span><span class="o">:</span> <span class="k">this</span><span class="o">.</span><span class="nx">configDisabled</span><span class="o">,</span>
                <span class="nx">validator</span><span class="o">:</span> <span class="nx">CheckBoolean</span><span class="o">,</span>
                <span class="nx">suppressEvent</span><span class="o">:</span> <span class="kc">true</span>
            <span class="o">}</span>
        <span class="o">);</span>


        <span class="c">/**</span>
<span class="c">        * @config selected</span>
<span class="c">        * @description Boolean indicating if the menu item should </span>
<span class="c">        * be highlighted.</span>
<span class="c">        * @default false</span>
<span class="c">        * @type Boolean</span>
<span class="c">        */</span>
        <span class="nx">oConfig</span><span class="o">.</span><span class="nx">addProperty</span><span class="o">(</span>
            <span class="s2">&quot;selected&quot;</span><span class="o">,</span>
            <span class="o">{</span>
                <span class="nx">value</span><span class="o">:</span> <span class="kc">false</span><span class="o">,</span>
                <span class="nx">handler</span><span class="o">:</span> <span class="k">this</span><span class="o">.</span><span class="nx">configSelected</span><span class="o">,</span>
                <span class="nx">validator</span><span class="o">:</span> <span class="nx">CheckBoolean</span><span class="o">,</span>
                <span class="nx">suppressEvent</span><span class="o">:</span> <span class="kc">true</span>
            <span class="o">}</span>
        <span class="o">);</span>


        <span class="c">/**</span>
<span class="c">        * @config submenu</span>
<span class="c">        * @description Object specifying the submenu to be appended to the </span>
<span class="c">        * menu item.  The value can be one of the following: &lt;ul&gt;&lt;li&gt;Object </span>
<span class="c">        * specifying a Menu instance.&lt;/li&gt;&lt;li&gt;Object literal specifying the</span>
<span class="c">        * menu to be created.  Format: &lt;code&gt;{ id: [menu id], itemdata: </span>
<span class="c">        * [&lt;a href=&quot;YAHOO.widget.Menu.html#itemData&quot;&gt;array of values for </span>
<span class="c">        * items&lt;/a&gt;] }&lt;/code&gt;.&lt;/li&gt;&lt;li&gt;String specifying the id attribute </span>
<span class="c">        * of the &lt;code&gt;&amp;#60;div&amp;#62;&lt;/code&gt; element of the menu.&lt;/li&gt;&lt;li&gt;</span>
<span class="c">        * Object specifying the &lt;code&gt;&amp;#60;div&amp;#62;&lt;/code&gt; element of the </span>
<span class="c">        * menu.&lt;/li&gt;&lt;/ul&gt;</span>
<span class="c">        * @default null</span>
<span class="c">        * @type Menu|String|Object|&lt;a href=&quot;http://www.w3.org/TR/2000/</span>
<span class="c">        * WD-DOM-Level-1-20000929/level-one-html.html#ID-58190037&quot;&gt;</span>
<span class="c">        * HTMLElement&lt;/a&gt;</span>
<span class="c">        */</span>
        <span class="nx">oConfig</span><span class="o">.</span><span class="nx">addProperty</span><span class="o">(</span><span class="s2">&quot;submenu&quot;</span><span class="o">,</span> <span class="o">{</span> <span class="nx">handler</span><span class="o">:</span> <span class="k">this</span><span class="o">.</span><span class="nx">configSubmenu</span> <span class="o">});</span>

	<span class="o">},</span>


    <span class="c">/**</span>
<span class="c">    * @method getNextEnabledSibling</span>
<span class="c">    * @description Finds the menu item&#39;s next enabled sibling.</span>
<span class="c">    * @return YAHOO.widget.MenuItem</span>
<span class="c">    */</span>
    <span class="nx">getNextEnabledSibling</span><span class="o">:</span> <span class="k">function</span><span class="o">()</span> <span class="o">{</span>

        <span class="k">if</span><span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">parent</span> <span class="k">instanceof</span> <span class="nx">Menu</span><span class="o">)</span> <span class="o">{</span>

            <span class="k">var</span> <span class="nx">nGroupIndex</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">groupIndex</span><span class="o">;</span>

            <span class="c">/**</span>
<span class="c">            * Finds the next item in an array.</span>
<span class="c">            * @private</span>
<span class="c">            * @param {p_aArray} Array to search.</span>
<span class="c">            * @param {p_nStartIndex} Number indicating the index to </span>
<span class="c">            * start searching the array.</span>
<span class="c">            * @return {Object}</span>
<span class="c">            */</span>
            <span class="k">function</span> <span class="nx">getNextArrayItem</span><span class="o">(</span><span class="nx">p_aArray</span><span class="o">,</span> <span class="nx">p_nStartIndex</span><span class="o">)</span> <span class="o">{</span>
    
                <span class="k">return</span> <span class="nx">p_aArray</span><span class="o">[</span><span class="nx">p_nStartIndex</span><span class="o">]</span> <span class="o">||</span> 
                    <span class="nx">getNextArrayItem</span><span class="o">(</span><span class="nx">p_aArray</span><span class="o">,</span> <span class="o">(</span><span class="nx">p_nStartIndex</span><span class="o">+</span><span class="m">1</span><span class="o">));</span>
    
            <span class="o">}</span>
    
    
            <span class="k">var</span> <span class="nx">aItemGroups</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">parent</span><span class="o">.</span><span class="nx">getItemGroups</span><span class="o">(),</span>
                <span class="nx">oNextItem</span><span class="o">;</span>
    
    
            <span class="k">if</span><span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">index</span> <span class="o">&lt;</span> <span class="o">(</span><span class="nx">aItemGroups</span><span class="o">[</span><span class="nx">nGroupIndex</span><span class="o">].</span><span class="nx">length</span> <span class="o">-</span> <span class="m">1</span><span class="o">))</span> <span class="o">{</span>
    
                <span class="nx">oNextItem</span> <span class="o">=</span> <span class="nx">getNextArrayItem</span><span class="o">(</span>
                        <span class="nx">aItemGroups</span><span class="o">[</span><span class="nx">nGroupIndex</span><span class="o">],</span> 
                        <span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">index</span><span class="o">+</span><span class="m">1</span><span class="o">)</span>
                    <span class="o">);</span>
    
            <span class="o">}</span>
            <span class="k">else</span> <span class="o">{</span>
    
                <span class="k">var</span> <span class="nx">nNextGroupIndex</span><span class="o">;</span>
    
                <span class="k">if</span><span class="o">(</span><span class="nx">nGroupIndex</span> <span class="o">&lt;</span> <span class="o">(</span><span class="nx">aItemGroups</span><span class="o">.</span><span class="nx">length</span> <span class="o">-</span> <span class="m">1</span><span class="o">))</span> <span class="o">{</span>
    
                    <span class="nx">nNextGroupIndex</span> <span class="o">=</span> <span class="nx">nGroupIndex</span> <span class="o">+</span> <span class="m">1</span><span class="o">;</span>
    
                <span class="o">}</span>
                <span class="k">else</span> <span class="o">{</span>
    
                    <span class="nx">nNextGroupIndex</span> <span class="o">=</span> <span class="m">0</span><span class="o">;</span>
    
                <span class="o">}</span>
    
                <span class="k">var</span> <span class="nx">aNextGroup</span> <span class="o">=</span> <span class="nx">getNextArrayItem</span><span class="o">(</span><span class="nx">aItemGroups</span><span class="o">,</span> <span class="nx">nNextGroupIndex</span><span class="o">);</span>
    
                <span class="c">// Retrieve the first menu item in the next group</span>
<span class="c"></span>    
                <span class="nx">oNextItem</span> <span class="o">=</span> <span class="nx">getNextArrayItem</span><span class="o">(</span><span class="nx">aNextGroup</span><span class="o">,</span> <span class="m">0</span><span class="o">);</span>
    
            <span class="o">}</span>
    
            <span class="k">return</span> <span class="o">(</span>
                <span class="nx">oNextItem</span><span class="o">.</span><span class="nx">cfg</span><span class="o">.</span><span class="nx">getProperty</span><span class="o">(</span><span class="s2">&quot;disabled&quot;</span><span class="o">)</span> <span class="o">||</span> 
                <span class="nx">oNextItem</span><span class="o">.</span><span class="nx">element</span><span class="o">.</span><span class="nx">style</span><span class="o">.</span><span class="nx">display</span> <span class="o">==</span> <span class="s2">&quot;none&quot;</span>
            <span class="o">)</span> <span class="o">?</span> 
            <span class="nx">oNextItem</span><span class="o">.</span><span class="nx">getNextEnabledSibling</span><span class="o">()</span> <span class="o">:</span> <span class="nx">oNextItem</span><span class="o">;</span>

        <span class="o">}</span>

    <span class="o">},</span>


    <span class="c">/**</span>
<span class="c">    * @method getPreviousEnabledSibling</span>
<span class="c">    * @description Finds the menu item&#39;s previous enabled sibling.</span>
<span class="c">    * @return {YAHOO.widget.MenuItem}</span>
<span class="c">    */</span>
    <span class="nx">getPreviousEnabledSibling</span><span class="o">:</span> <span class="k">function</span><span class="o">()</span> <span class="o">{</span>

        <span class="k">if</span><span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">parent</span> <span class="k">instanceof</span> <span class="nx">Menu</span><span class="o">)</span> <span class="o">{</span>

            <span class="k">var</span> <span class="nx">nGroupIndex</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">groupIndex</span><span class="o">;</span>

            <span class="c">/**</span>
<span class="c">            * Returns the previous item in an array </span>
<span class="c">            * @private</span>
<span class="c">            * @param {p_aArray} Array to search.</span>
<span class="c">            * @param {p_nStartIndex} Number indicating the index to </span>
<span class="c">            * start searching the array.</span>
<span class="c">            * @return {Object}</span>
<span class="c">            */</span>
            <span class="k">function</span> <span class="nx">getPreviousArrayItem</span><span class="o">(</span><span class="nx">p_aArray</span><span class="o">,</span> <span class="nx">p_nStartIndex</span><span class="o">)</span> <span class="o">{</span>
    
                <span class="k">return</span> <span class="nx">p_aArray</span><span class="o">[</span><span class="nx">p_nStartIndex</span><span class="o">]</span> <span class="o">||</span> 
                    <span class="nx">getPreviousArrayItem</span><span class="o">(</span><span class="nx">p_aArray</span><span class="o">,</span> <span class="o">(</span><span class="nx">p_nStartIndex</span><span class="o">-</span><span class="m">1</span><span class="o">));</span>
    
            <span class="o">}</span>


            <span class="c">/**</span>
<span class="c">            * Get the index of the first item in an array </span>
<span class="c">            * @private</span>
<span class="c">            * @param {p_aArray} Array to search.</span>
<span class="c">            * @param {p_nStartIndex} Number indicating the index to </span>
<span class="c">            * start searching the array.</span>
<span class="c">            * @return {Object}</span>
<span class="c">            */</span>    
            <span class="k">function</span> <span class="nx">getFirstItemIndex</span><span class="o">(</span><span class="nx">p_aArray</span><span class="o">,</span> <span class="nx">p_nStartIndex</span><span class="o">)</span> <span class="o">{</span>
    
                <span class="k">return</span> <span class="nx">p_aArray</span><span class="o">[</span><span class="nx">p_nStartIndex</span><span class="o">]</span> <span class="o">?</span> 
                    <span class="nx">p_nStartIndex</span> <span class="o">:</span> 
                    <span class="nx">getFirstItemIndex</span><span class="o">(</span><span class="nx">p_aArray</span><span class="o">,</span> <span class="o">(</span><span class="nx">p_nStartIndex</span><span class="o">+</span><span class="m">1</span><span class="o">));</span>
    
            <span class="o">}</span>
    
            <span class="k">var</span> <span class="nx">aItemGroups</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">parent</span><span class="o">.</span><span class="nx">getItemGroups</span><span class="o">(),</span>
                <span class="nx">oPreviousItem</span><span class="o">;</span>
    
            <span class="k">if</span><span class="o">(</span>
                <span class="k">this</span><span class="o">.</span><span class="nx">index</span> <span class="o">&gt;</span> <span class="nx">getFirstItemIndex</span><span class="o">(</span><span class="nx">aItemGroups</span><span class="o">[</span><span class="nx">nGroupIndex</span><span class="o">],</span> <span class="m">0</span><span class="o">)</span>
            <span class="o">)</span> <span class="o">{</span>
    
                <span class="nx">oPreviousItem</span> <span class="o">=</span> 
                    <span class="nx">getPreviousArrayItem</span><span class="o">(</span>
                        <span class="nx">aItemGroups</span><span class="o">[</span><span class="nx">nGroupIndex</span><span class="o">],</span> 
                        <span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">index</span><span class="o">-</span><span class="m">1</span><span class="o">)</span>
                    <span class="o">);</span>
    
            <span class="o">}</span>
            <span class="k">else</span> <span class="o">{</span>
    
                <span class="k">var</span> <span class="nx">nPreviousGroupIndex</span><span class="o">;</span>
    
                <span class="k">if</span><span class="o">(</span><span class="nx">nGroupIndex</span> <span class="o">&gt;</span> <span class="nx">getFirstItemIndex</span><span class="o">(</span><span class="nx">aItemGroups</span><span class="o">,</span> <span class="m">0</span><span class="o">))</span> <span class="o">{</span>
    
                    <span class="nx">nPreviousGroupIndex</span> <span class="o">=</span> <span class="nx">nGroupIndex</span> <span class="o">-</span> <span class="m">1</span><span class="o">;</span>
    
                <span class="o">}</span>
                <span class="k">else</span> <span class="o">{</span>
    
                    <span class="nx">nPreviousGroupIndex</span> <span class="o">=</span> <span class="nx">aItemGroups</span><span class="o">.</span><span class="nx">length</span> <span class="o">-</span> <span class="m">1</span><span class="o">;</span>
    
                <span class="o">}</span>
    
                <span class="k">var</span> <span class="nx">aPreviousGroup</span> <span class="o">=</span> 
                        <span class="nx">getPreviousArrayItem</span><span class="o">(</span><span class="nx">aItemGroups</span><span class="o">,</span> <span class="nx">nPreviousGroupIndex</span><span class="o">);</span>
    
                <span class="nx">oPreviousItem</span> <span class="o">=</span> 
                    <span class="nx">getPreviousArrayItem</span><span class="o">(</span>
                        <span class="nx">aPreviousGroup</span><span class="o">,</span> 
                        <span class="o">(</span><span class="nx">aPreviousGroup</span><span class="o">.</span><span class="nx">length</span> <span class="o">-</span> <span class="m">1</span><span class="o">)</span>
                    <span class="o">);</span>
    
            <span class="o">}</span>

            <span class="k">return</span> <span class="o">(</span>
                <span class="nx">oPreviousItem</span><span class="o">.</span><span class="nx">cfg</span><span class="o">.</span><span class="nx">getProperty</span><span class="o">(</span><span class="s2">&quot;disabled&quot;</span><span class="o">)</span> <span class="o">||</span> 
                <span class="nx">oPreviousItem</span><span class="o">.</span><span class="nx">element</span><span class="o">.</span><span class="nx">style</span><span class="o">.</span><span class="nx">display</span> <span class="o">==</span> <span class="s2">&quot;none&quot;</span>
            <span class="o">)</span> <span class="o">?</span> 
            <span class="nx">oPreviousItem</span><span class="o">.</span><span class="nx">getPreviousEnabledSibling</span><span class="o">()</span> <span class="o">:</span> <span class="nx">oPreviousItem</span><span class="o">;</span>

        <span class="o">}</span>

    <span class="o">},</span>


    <span class="c">/**</span>
<span class="c">    * @method focus</span>
<span class="c">    * @description Causes the menu item to receive the focus and fires the </span>
<span class="c">    * focus event.</span>
<span class="c">    */</span>
    <span class="nx">focus</span><span class="o">:</span> <span class="k">function</span><span class="o">()</span> <span class="o">{</span>

        <span class="k">var</span> <span class="nx">oParent</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">parent</span><span class="o">,</span>
            <span class="nx">oAnchor</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">_oAnchor</span><span class="o">,</span>
            <span class="nx">oActiveItem</span> <span class="o">=</span> <span class="nx">oParent</span><span class="o">.</span><span class="nx">activeItem</span><span class="o">;</span>


        <span class="k">function</span> <span class="nx">setFocus</span><span class="o">()</span> <span class="o">{</span>

            <span class="k">try</span> <span class="o">{</span>

                <span class="nx">oAnchor</span><span class="o">.</span><span class="nx">focus</span><span class="o">();</span>

            <span class="o">}</span>
            <span class="k">catch</span><span class="o">(</span><span class="nx">e</span><span class="o">)</span> <span class="o">{</span>
            
            <span class="o">}</span>

        <span class="o">}</span>


        <span class="k">if</span><span class="o">(</span>
            <span class="o">!</span><span class="k">this</span><span class="o">.</span><span class="nx">cfg</span><span class="o">.</span><span class="nx">getProperty</span><span class="o">(</span><span class="s2">&quot;disabled&quot;</span><span class="o">)</span> <span class="o">&amp;&amp;</span> 
            <span class="nx">oParent</span> <span class="o">&amp;&amp;</span> 
            <span class="nx">oParent</span><span class="o">.</span><span class="nx">cfg</span><span class="o">.</span><span class="nx">getProperty</span><span class="o">(</span><span class="s2">&quot;visible&quot;</span><span class="o">)</span> <span class="o">&amp;&amp;</span> 
            <span class="k">this</span><span class="o">.</span><span class="nx">element</span><span class="o">.</span><span class="nx">style</span><span class="o">.</span><span class="nx">display</span> <span class="o">!=</span> <span class="s2">&quot;none&quot;</span>
        <span class="o">)</span> <span class="o">{</span>

            <span class="k">if</span><span class="o">(</span><span class="nx">oActiveItem</span><span class="o">)</span> <span class="o">{</span>

                <span class="nx">oActiveItem</span><span class="o">.</span><span class="nx">blur</span><span class="o">();</span>

            <span class="o">}</span>


            <span class="c">/*</span>
<span class="c">                Setting focus via a timer fixes a race condition in Firefox, IE </span>
<span class="c">                and Opera where the browser viewport jumps as it trys to </span>
<span class="c">                position and focus the menu.</span>
<span class="c">            */</span>

            <span class="nb">window</span><span class="o">.</span><span class="nx">setTimeout</span><span class="o">(</span><span class="nx">setFocus</span><span class="o">,</span> <span class="m">0</span><span class="o">);</span>
            
            <span class="k">this</span><span class="o">.</span><span class="nx">focusEvent</span><span class="o">.</span><span class="nx">fire</span><span class="o">();</span>

        <span class="o">}</span>

    <span class="o">},</span>


    <span class="c">/**</span>
<span class="c">    * @method blur</span>
<span class="c">    * @description Causes the menu item to lose focus and fires the </span>
<span class="c">    * onblur event.</span>
<span class="c">    */</span>    
    <span class="nx">blur</span><span class="o">:</span> <span class="k">function</span><span class="o">()</span> <span class="o">{</span>

        <span class="k">var</span> <span class="nx">oParent</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">parent</span><span class="o">;</span>

        <span class="k">if</span><span class="o">(</span>
            <span class="o">!</span><span class="k">this</span><span class="o">.</span><span class="nx">cfg</span><span class="o">.</span><span class="nx">getProperty</span><span class="o">(</span><span class="s2">&quot;disabled&quot;</span><span class="o">)</span> <span class="o">&amp;&amp;</span> 
            <span class="nx">oParent</span> <span class="o">&amp;&amp;</span> 
            <span class="nx">Dom</span><span class="o">.</span><span class="nx">getStyle</span><span class="o">(</span><span class="nx">oParent</span><span class="o">.</span><span class="nx">element</span><span class="o">,</span> <span class="s2">&quot;visibility&quot;</span><span class="o">)</span> <span class="o">==</span> <span class="s2">&quot;visible&quot;</span>
        <span class="o">)</span> <span class="o">{</span>

            <span class="k">this</span><span class="o">.</span><span class="nx">_oAnchor</span><span class="o">.</span><span class="nx">blur</span><span class="o">();</span>

            <span class="k">this</span><span class="o">.</span><span class="nx">blurEvent</span><span class="o">.</span><span class="nx">fire</span><span class="o">();</span>

        <span class="o">}</span>

    <span class="o">},</span>


	<span class="c">/**</span>
<span class="c">    * @method destroy</span>
<span class="c">	* @description Removes the menu item&#39;s &lt;code&gt;&amp;#60;li&amp;#62;&lt;/code&gt; element </span>
<span class="c">	* from its parent &lt;code&gt;&amp;#60;ul&amp;#62;&lt;/code&gt; element.</span>
<span class="c">	*/</span>
    <span class="nx">destroy</span><span class="o">:</span> <span class="k">function</span><span class="o">()</span> <span class="o">{</span>

        <span class="k">var</span> <span class="nx">oEl</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">element</span><span class="o">;</span>

        <span class="k">if</span><span class="o">(</span><span class="nx">oEl</span><span class="o">)</span> <span class="o">{</span>


            <span class="c">// If the item has a submenu, destroy it first</span>
<span class="c"></span>
            <span class="k">var</span> <span class="nx">oSubmenu</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">cfg</span><span class="o">.</span><span class="nx">getProperty</span><span class="o">(</span><span class="s2">&quot;submenu&quot;</span><span class="o">);</span>

            <span class="k">if</span><span class="o">(</span><span class="nx">oSubmenu</span><span class="o">)</span> <span class="o">{</span>
            
                <span class="nx">oSubmenu</span><span class="o">.</span><span class="nx">destroy</span><span class="o">();</span>
            
            <span class="o">}</span>


            <span class="c">// Remove CustomEvent listeners</span>
<span class="c"></span>    
            <span class="k">this</span><span class="o">.</span><span class="nx">mouseOverEvent</span><span class="o">.</span><span class="nx">unsubscribeAll</span><span class="o">();</span>
            <span class="k">this</span><span class="o">.</span><span class="nx">mouseOutEvent</span><span class="o">.</span><span class="nx">unsubscribeAll</span><span class="o">();</span>
            <span class="k">this</span><span class="o">.</span><span class="nx">mouseDownEvent</span><span class="o">.</span><span class="nx">unsubscribeAll</span><span class="o">();</span>
            <span class="k">this</span><span class="o">.</span><span class="nx">mouseUpEvent</span><span class="o">.</span><span class="nx">unsubscribeAll</span><span class="o">();</span>
            <span class="k">this</span><span class="o">.</span><span class="nx">clickEvent</span><span class="o">.</span><span class="nx">unsubscribeAll</span><span class="o">();</span>
            <span class="k">this</span><span class="o">.</span><span class="nx">keyPressEvent</span><span class="o">.</span><span class="nx">unsubscribeAll</span><span class="o">();</span>
            <span class="k">this</span><span class="o">.</span><span class="nx">keyDownEvent</span><span class="o">.</span><span class="nx">unsubscribeAll</span><span class="o">();</span>
            <span class="k">this</span><span class="o">.</span><span class="nx">keyUpEvent</span><span class="o">.</span><span class="nx">unsubscribeAll</span><span class="o">();</span>
            <span class="k">this</span><span class="o">.</span><span class="nx">focusEvent</span><span class="o">.</span><span class="nx">unsubscribeAll</span><span class="o">();</span>
            <span class="k">this</span><span class="o">.</span><span class="nx">blurEvent</span><span class="o">.</span><span class="nx">unsubscribeAll</span><span class="o">();</span>
            <span class="k">this</span><span class="o">.</span><span class="nx">cfg</span><span class="o">.</span><span class="nx">configChangedEvent</span><span class="o">.</span><span class="nx">unsubscribeAll</span><span class="o">();</span>


            <span class="c">// Remove the element from the parent node</span>
<span class="c"></span>
            <span class="k">var</span> <span class="nx">oParentNode</span> <span class="o">=</span> <span class="nx">oEl</span><span class="o">.</span><span class="nx">parentNode</span><span class="o">;</span>

            <span class="k">if</span><span class="o">(</span><span class="nx">oParentNode</span><span class="o">)</span> <span class="o">{</span>

                <span class="nx">oParentNode</span><span class="o">.</span><span class="nx">removeChild</span><span class="o">(</span><span class="nx">oEl</span><span class="o">);</span>

                <span class="k">this</span><span class="o">.</span><span class="nx">destroyEvent</span><span class="o">.</span><span class="nx">fire</span><span class="o">();</span>

            <span class="o">}</span>

            <span class="k">this</span><span class="o">.</span><span class="nx">destroyEvent</span><span class="o">.</span><span class="nx">unsubscribeAll</span><span class="o">();</span>

        <span class="o">}</span>

    <span class="o">},</span>


    <span class="c">/**</span>
<span class="c">    * @method toString</span>
<span class="c">    * @description Returns a string representing the menu item.</span>
<span class="c">    * @return {String}</span>
<span class="c">    */</span>
    <span class="nx">toString</span><span class="o">:</span> <span class="k">function</span><span class="o">()</span> <span class="o">{</span>
    
        <span class="k">return</span> <span class="o">(</span><span class="s2">&quot;MenuItem: &quot;</span> <span class="o">+</span> <span class="k">this</span><span class="o">.</span><span class="nx">cfg</span><span class="o">.</span><span class="nx">getProperty</span><span class="o">(</span><span class="s2">&quot;text&quot;</span><span class="o">));</span>
    
    <span class="o">}</span>

<span class="o">};</span>

<span class="o">})();</span>
</pre></div>
                    </div>
			</div>
		</div>
		<div class="yui-b">
            <div class="nav">

                    <div class="module">
                        <h4>Modules</h4>
                        <ul class="content">

                                <li class=""><a href="module_animation.html">animation</a></li>

                                <li class=""><a href="module_autocomplete.html">autocomplete</a></li>

                                <li class=""><a href="module_calendar.html">calendar</a></li>

                                <li class=""><a href="module_connection.html">connection</a></li>

                                <li class=""><a href="module_container.html">container</a></li>

                                <li class=""><a href="module_dom.html">dom</a></li>

                                <li class=""><a href="module_dragdrop.html">dragdrop</a></li>

                                <li class=""><a href="module_event.html">event</a></li>

                                <li class=""><a href="module_logger.html">logger</a></li>

                                <li class="selected"><a href="module_menu.html">menu</a></li>

                                <li class=""><a href="module_slider.html">slider</a></li>

                                <li class=""><a href="module_tabview.html">tabview</a></li>

                                <li class=""><a href="module_treeview.html">treeview</a></li>

                                <li class=""><a href="module_yahoo.html">yahoo</a></li>
                        </ul>
                    </div>

                    <div class="module">
                        <h4>Classes</h4>
                        <ul class="content">
                                <li class=""><a href="YAHOO.widget.ContextMenu.html">YAHOO.widget.ContextMenu</a></li>
                                <li class=""><a href="YAHOO.widget.ContextMenuItem.html">YAHOO.widget.ContextMenuItem</a></li>
                                <li class=""><a href="YAHOO.widget.Menu.html">YAHOO.widget.Menu</a></li>
                                <li class=""><a href="YAHOO.widget.Menubar.html">YAHOO.widget.Menubar</a></li>
                                <li class=""><a href="YAHOO.widget.MenuBarItem.html">YAHOO.widget.MenuBarItem</a></li>
                                <li class=""><a href="YAHOO.widget.MenuItem.html">YAHOO.widget.MenuItem</a></li>
                                <li class=""><a href="YAHOO.widget.MenuManager.html">YAHOO.widget.MenuManager</a></li>
                                <li class=""><a href="YAHOO.widget.MenuModule.html">YAHOO.widget.MenuModule</a></li>
                                <li class=""><a href="YAHOO.widget.MenuModuleItem.html">YAHOO.widget.MenuModuleItem</a></li>
                        </ul>
                    </div>

                    <div class="module">
                        <h4>Files</h4>
                        <ul class="content">        
                                <li class=""><a href="contextmenu.js.html">contextmenu.js</a></li>
                                <li class=""><a href="contextmenuitem.js.html">contextmenuitem.js</a></li>
                                <li class=""><a href="menu.js.html">menu.js</a></li>
                                <li class=""><a href="menubar.js.html">menubar.js</a></li>
                                <li class=""><a href="menubaritem.js.html">menubaritem.js</a></li>
                                <li class="selected"><a href="menuitem.js.html">menuitem.js</a></li>
                                <li class=""><a href="menumanager.js.html">menumanager.js</a></li>
                                <li class=""><a href="menumodule.js.html">menumodule.js</a></li>
                                <li class=""><a href="menumoduleitem.js.html">menumoduleitem.js</a></li>
                        </ul>
                    </div>





            </div>
		</div>
	</div>
	<div id="ft">
        <hr />
        Copyright &copy; 2006 Yahoo! Inc. All rights reserved.
	</div>
</div>
</body>
</html>
